Class: Trafaret::Proc
Instance Attribute Summary
Attributes inherited from Validator
Instance Method Summary collapse
Methods inherited from Validator
#&, #===, #add, #call, #convert, #failure, #initialize, #perform_convert, #to, #|
Constructor Details
This class inherits a constructor from Trafaret::Validator
Instance Method Details
#prepare ⇒ Object
164 165 166 167 |
# File 'lib/trafaret/validators.rb', line 164 def prepare raise 'Need to call with block' if @converters.blank? @blk = @converters.pop end |
#validate(data) ⇒ Object
169 170 171 |
# File 'lib/trafaret/validators.rb', line 169 def validate(data) @blk.call(data) end |