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
# File 'lib/command_processor/container.rb', line 5

def resolve_by_type(type)
  key, service = @services.find{|key, service| !service.is_a?(Proc) && service <= type}
  key ? resolve(key) : raise(::IOC::UnknownServiceError, "Service of type '#{type}' not registered")
end