Sha256: 7663078ee74fe9d15dbe766a79b6904716821c36bc29b715944298f23ac06c9d
Contents?: true
Size: 546 Bytes
Versions: 4
Compression:
Stored size: 546 Bytes
Contents
module Errawr class Mapper @@errors = {} def self.all @@errors.dup end def self.[](key) @@errors[key.to_sym] end def self.add(error) @@errors[error.key] = error end 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 register!(:unknown) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
errawr-1.1.3 | lib/errawr/mapper.rb |
errawr-1.1.2 | lib/errawr/mapper.rb |
errawr-1.1.1 | lib/errawr/mapper.rb |
errawr-1.1.0 | lib/errawr/mapper.rb |