Sha256: 8af9759818650485eef253c1cf037a523d1978b95025cb6dc9d43a67b3a69fc8
Contents?: true
Size: 429 Bytes
Versions: 1
Compression:
Stored size: 429 Bytes
Contents
class HashValidator::Validator::PresenceValidator < HashValidator::Validator::Base def name 'required' end def presence_error_message 'is required' end def should_validate?(rhs) rhs == name end def validate(key, value, validations, errors) unless value errors[key] = presence_error_message end end end HashValidator.append_validator(HashValidator::Validator::PresenceValidator.new)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hash_validator-0.1.0 | lib/hash_validator/validators/presence_validator.rb |