Sha256: fa5ba9b760e453bdc4d471ffe9928abe719e1bdf36fb104ab1f326088a97c00d
Contents?: true
Size: 506 Bytes
Versions: 3
Compression:
Stored size: 506 Bytes
Contents
class HashValidator::Validator::Base attr_accessor :name def initialize(name) self.name = name.to_s unless self.name.size > 0 raise StandardError.new('Validator must be initialized with a valid name (length greater than zero)') end end def should_validate?(name) self.name == name.to_s end def presence_error_message "#{self.name} required" end def validate(*) raise StandardError.new('validate should not be called directly on BaseValidator') end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hash_validator-1.1.0 | lib/hash_validator/validators/base.rb |
hash_validator-1.0.0 | lib/hash_validator/validators/base.rb |
hash_validator-0.8.0 | lib/hash_validator/validators/base.rb |