Module: Validatable::Understandable
- Included in:
- ValidationBase
- Defined in:
- lib/understandable.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
18 19 20 |
# File 'lib/understandable.rb', line 18 def self.included(klass) klass.extend ClassMethods end |
Instance Method Details
#must_understand(hash) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/understandable.rb', line 22 def must_understand(hash) = hash.inject([]) do |errors, (key, value)| errors << key.to_s unless self.class.all_understandings.include?(key) errors end raise ArgumentError.new("invalid options: #{.join(', ')}") if .any? true end |