Class: CommandProcessor::Container

Inherits:
IOC::Container
  • Object
show all
Defined in:
lib/command_processor/container.rb

Instance Method Summary collapse

Instance Method Details

#resolve_by_type(type) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/command_processor/container.rb', line 5

def resolve_by_type(type)
  if found_service = @services.find{|key, service| service if service <= type}
    key = found_service[0]
    resolve(key)
  else
    raise(::IOC::UnknownServiceError, "Service of type '#{type}' not registered")
  end
end