Class: Inflect::Director

Inherits:
Object
  • Object
show all
Defined in:
lib/inflect/director.rb

Overview

The class in charge of managing the access and selection of the services.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(services_path = nil) ⇒ Director


11
12
13
14
15
# File 'lib/inflect/director.rb', line 11

def initialize(services_path = nil)
  @services = Loader.services(
    services_path || Inflect.configuration.services_path
  )
end

Instance Attribute Details

#servicesObject (readonly)

Returns the value of attribute services


8
9
10
# File 'lib/inflect/director.rb', line 8

def services
  @services
end

Instance Method Details

#handle(words) ⇒ Object

Finds the first Service that is able to handle the request and lets him do the work.


21
22
23
24
# File 'lib/inflect/director.rb', line 21

def handle(words)
  selected_service = select_service(words)
  selected_service.handle(words) unless selected_service.nil?
end