Module: HashAttributeAssignment::ClassMethods
- Defined in:
- lib/hash_attribute_assignment.rb
Defined Under Namespace
Classes: HashValidation
Instance Method Summary collapse
Instance Method Details
#validate_hash(proc, options = { message: 'Hash failed validation' }) ⇒ Object
5 6 7 8 |
# File 'lib/hash_attribute_assignment.rb', line 5 def validate_hash(proc, = { message: 'Hash failed validation' }) raise ArgumentError('First arg must be a call-able') unless proc.respond_to? :call class_variable_set(:@@hash_validations, hash_validations + [HashValidation.new(proc, [:message])]) end |