Class: KStor::ErrorRegistry Private
- Inherits:
-
Object
- Object
- KStor::ErrorRegistry
- Defined in:
- lib/kstor/error.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Basically an Array of error subclasses, with an index on error codes.
Instance Method Summary collapse
-
#<<(klass) ⇒ Object
private
Append an error class.
-
#[](code) ⇒ Object
private
Return subclass for this error code.
-
#classes ⇒ Object
private
List of subclasses.
-
#initialize ⇒ ErrorRegistry
constructor
private
Create new registry.
-
#key?(code) ⇒ Boolean
private
True if registry knows a subclass with this error code.
Constructor Details
#initialize ⇒ ErrorRegistry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create new registry.
86 87 88 89 |
# File 'lib/kstor/error.rb', line 86 def initialize @error_classes = [] @index = nil end |
Instance Method Details
#<<(klass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Append an error class.
97 98 99 100 |
# File 'lib/kstor/error.rb', line 97 def <<(klass) @error_classes << klass @index = nil end |
#[](code) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return subclass for this error code.
108 109 110 |
# File 'lib/kstor/error.rb', line 108 def [](code) index[code] end |
#classes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
List of subclasses.
92 93 94 |
# File 'lib/kstor/error.rb', line 92 def classes @error_classes.values end |
#key?(code) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
True if registry knows a subclass with this error code.
103 104 105 |
# File 'lib/kstor/error.rb', line 103 def key?(code) index.key?(code) end |