Exception: Dry::Types::ConstraintError
- Inherits:
-
TypeError
- Object
- TypeError
- 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.
- #to_s ⇒ String
Constructor Details
#initialize(result, input) ⇒ ConstraintError
Returns a new instance of ConstraintError.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dry/types/errors.rb', line 42 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)
38 39 40 |
# File 'lib/dry/types/errors.rb', line 38 def input @input end |
#result ⇒ String, #to_s (readonly)
36 37 38 |
# File 'lib/dry/types/errors.rb', line 36 def result @result end |
Instance Method Details
#to_s ⇒ String
54 55 56 |
# File 'lib/dry/types/errors.rb', line 54 def to_s "#{input.inspect} violates constraints (#{result} failed)" end |