Class: Mountapi::Handler::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/mountapi/handler/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry



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