Sha256: 9a93451b5536a50b6e5384b394553e4fcc2c9a7067e61116fb2a86664f9d2acd
Contents?: true
Size: 567 Bytes
Versions: 2
Compression:
Stored size: 567 Bytes
Contents
class HashValidator::Base attr_accessor :hash, :validations, :errors def initialize(hash, validations) self.errors = {} self.hash = hash self.validations = validations validate end def valid? errors.empty? end def self.validate(hash, validations, strict = false) @strict = strict new(hash, validations) end def self.strict? @strict end private def validate HashValidator.validator_for(hash).validate(:base, self.hash, self.validations, self.errors) self.errors = errors[:base] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hash_validator-1.1.0 | lib/hash_validator/base.rb |
hash_validator-1.0.0 | lib/hash_validator/base.rb |