Class: Validatable::Errors
- Inherits:
-
Hash
- Object
- Hash
- Validatable::Errors
- Defined in:
- lib/validatable/errors.rb
Instance Method Summary collapse
- #add(attribute, message) ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
3 4 5 |
# File 'lib/validatable/errors.rb', line 3 def initialize super([]) end |
Instance Method Details
#add(attribute, message) ⇒ Object
7 8 9 10 11 |
# File 'lib/validatable/errors.rb', line 7 def add attribute, attribute = attribute.to_sym self[attribute] = [] unless self.include? attribute self[attribute].push *Array() end |