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
151 152 153 154 |
# File 'lib/trafaret/validators.rb', line 151 def prepare raise 'Need to call with block' if @converters.blank? @blk = @converters.pop end |
#validate(data) ⇒ Object
156 157 158 |
# File 'lib/trafaret/validators.rb', line 156 def validate(data) @blk.call(data) end |