Sha256: f36207ac934abdae0783f83a4f045daa68692c934ad0d1cbb6e1067dec5b1d65
Contents?: true
Size: 399 Bytes
Versions: 1
Compression:
Stored size: 399 Bytes
Contents
module Yema class Validator attr_reader :rule, :resource def initialize(rule, resource) @rule, @resource = rule, resource end def value resource.public_send(rule.attribute_name) end def valid? rule.matches?(value) end def errors errors = [] errors << Error.new(rule, resource) unless valid? errors.to_set end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yema-0.0.1 | lib/yema/validator.rb |