Class: SimpleCommand::Errors

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

Instance Method Summary collapse

Instance Method Details

#add_error(key, value) ⇒ Object



5
6
7
8
9
# File 'lib/simple_command/errors.rb', line 5

def add_error(key, value)
  self[key] ||= []
  self[key] << value
  self[key].uniq!
end

#add_multiple_errors(errors_hash) ⇒ Object



11
12
13
14
15
# File 'lib/simple_command/errors.rb', line 11

def add_multiple_errors(errors_hash)
  errors_hash.each do |key, values|
    values.each { |value| add_error key, value }
  end
end