Class: Biz::Validation::Rule
- Inherits:
-
Object
- Object
- Biz::Validation::Rule
- Defined in:
- lib/biz/validation.rb
Instance Method Summary collapse
- #check(raw) ⇒ Object
-
#initialize(message, &condition) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(message, &condition) ⇒ Rule
Returns a new instance of Rule.
26 27 28 29 |
# File 'lib/biz/validation.rb', line 26 def initialize(, &condition) @message = @condition = condition end |
Instance Method Details
#check(raw) ⇒ Object
31 32 33 |
# File 'lib/biz/validation.rb', line 31 def check(raw) fail Error::Configuration, unless condition.call(raw) end |