class Errawr::Mapper

Public Class Methods

[](key) click to toggle source
# File lib/errawr/mapper.rb, line 9
def self.[](key)
  @@errors[key.to_sym]
end
add(error) click to toggle source
# File lib/errawr/mapper.rb, line 13
def self.add(error)
  @@errors[error.key] = error
end
all() click to toggle source
# File lib/errawr/mapper.rb, line 5
def self.all
  @@errors.dup
end
register!(key, options = {}) click to toggle source
# File lib/errawr/mapper.rb, line 17
def self.register!(key, options = {})
  base_klass = options[:base_class] || Error
  raise(ArgumentError, ':base_class must be a subclass of Errawr::Error') unless base_klass <= Error
  klass = Class.new(base_klass).new(key, options)
  add(klass)
end