Method: KStor::Error.inherited
- Defined in:
- lib/kstor/error.rb
.inherited(subclass) ⇒ Object
When subclassed, add child to registry.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/kstor/error.rb', line 48 def self.inherited(subclass) super @registry ||= ErrorRegistry.new if @registry.key?(subclass.code) code = subclass.code klass = @registry[code] raise "duplicate error code #{code} in #{subclass}, " \ "already defined in #{klass}" end @registry << subclass end |