Sha256: 4863f779dc579c15a7e6ef181faf3bbd4a004391dff3d1c22ac0d8da4918beb9

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

module Lev::Handler

  class Errors < Array
    def add(args)
      push(Error.new(args))
    end

    def [](key)
      self[key]
    end

    # 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])
    def has_offending_param?(param)
      self.any?{|error| error.offending_params == param}
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lev-0.0.3 lib/lev/handler/errors.rb
lev-0.0.2 lib/lev/handler/errors.rb
lev-0.0.1 lib/lev/handler/errors.rb