Class: Lev::Handler::Errors

Inherits:
Array
  • Object
show all
Defined in:
lib/lev/handler/errors.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



8
9
10
# File 'lib/lev/handler/errors.rb', line 8

def [](key)
  self[key]
end

#add(args) ⇒ Object



4
5
6
# File 'lib/lev/handler/errors.rb', line 4

def add(args)
  push(Error.new(args))
end

#has_offending_param?(param) ⇒ Boolean

Checks to see if the provided param identifier is one of the offending params, e.g. has_offending_param?([:my_form, :my_text_field_name])



14
15
16
# File 'lib/lev/handler/errors.rb', line 14

def has_offending_param?(param)
  self.any?{|error| error.offending_params == param}
end