Exception: Dry::Types::ConstraintError
- Inherits:
-
CoercionError
- Object
- StandardError
- CoercionError
- Dry::Types::ConstraintError
- Defined in:
- lib/dry/types/errors.rb
Instance Attribute Summary collapse
- #input ⇒ Object readonly
- #result ⇒ String, #to_s readonly
Instance Method Summary collapse
-
#initialize(result, input) ⇒ ConstraintError
constructor
A new instance of ConstraintError.
- #message ⇒ String (also: #to_s)
Constructor Details
#initialize(result, input) ⇒ ConstraintError
Returns a new instance of ConstraintError.
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/dry/types/errors.rb', line 124 def initialize(result, input) @result = result @input = input if result.is_a?(String) super(result) else super(to_s) end end |
Instance Attribute Details
#input ⇒ Object (readonly)
120 121 122 |
# File 'lib/dry/types/errors.rb', line 120 def input @input end |
#result ⇒ String, #to_s (readonly)
118 119 120 |
# File 'lib/dry/types/errors.rb', line 118 def result @result end |
Instance Method Details
#message ⇒ String Also known as: to_s
136 137 138 |
# File 'lib/dry/types/errors.rb', line 136 def "#{input.inspect} violates constraints (#{result} failed)" end |