Class: Validatable::Errors

Inherits:
Hash
  • Object
show all
Defined in:
lib/validatable/errors.rb

Instance Method Summary collapse

Constructor Details

#initializeErrors

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
# File 'lib/validatable/errors.rb', line 7

def add attribute, message
  self[attribute] = [] unless self.include? attribute
  self[attribute].push *Array(message)
end