Class: Mountapi::Handler::Registry
- Inherits:
-
Object
- Object
- Mountapi::Handler::Registry
- Defined in:
- lib/mountapi/handler/registry.rb
Instance Method Summary collapse
- #[](operation_id) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #register(operation_id, handler) ⇒ Object
Constructor Details
#initialize ⇒ Registry
4 5 6 |
# File 'lib/mountapi/handler/registry.rb', line 4 def initialize @handlers = {} end |
Instance Method Details
#[](operation_id) ⇒ Object
12 13 14 15 16 |
# File 'lib/mountapi/handler/registry.rb', line 12 def [](operation_id) @handlers.fetch(operation_id) rescue KeyError raise Error::HandlerMissing.new(operation_id) end |
#register(operation_id, handler) ⇒ Object
8 9 10 |
# File 'lib/mountapi/handler/registry.rb', line 8 def register(operation_id, handler) @handlers[operation_id] = handler end |