class Hval::Schema
Public Class Methods
new(schema)
click to toggle source
# File lib/hval/schema.rb, line 5 def initialize(schema) @validators = schema.collect do |op, spec| method("validate_#{op}").call(spec) end end
Public Instance Methods
call(value)
click to toggle source
# File lib/hval/schema.rb, line 15 def call(value) @validators.collect do |validator| validator.call(value) end end
match?(value)
click to toggle source
# File lib/hval/schema.rb, line 21 def match?(value) Hval::Result.new(self.call(value)).success? end
validators()
click to toggle source
# File lib/hval/schema.rb, line 11 def validators @validators end