Exception: Constrain::MatchError
- Inherits:
-
StandardError
- Object
- StandardError
- Constrain::MatchError
- Defined in:
- lib/constrain.rb
Overview
Raised if types doesn’t match a class expression
Instance Method Summary collapse
-
#initialize(value, exprs, message: nil, unwind: 0, not_argument: false, not_value: nil) ⇒ MatchError
constructor
A new instance of MatchError.
Constructor Details
#initialize(value, exprs, message: nil, unwind: 0, not_argument: false, not_value: nil) ⇒ MatchError
Returns a new instance of MatchError.
6 7 8 9 10 11 12 |
# File 'lib/constrain.rb', line 6 def initialize(value, exprs, message: nil, unwind: 0, not_argument: false, not_value: nil) if not_argument super || "Expected #{value.inspect} to not equal #{not_value.inspect}" else super || "Expected #{value.inspect} to match #{Constrain.fmt_exprs(exprs)}" end end |