Class: Inflect::Director
- Inherits:
-
Object
- Object
- Inflect::Director
- Includes:
- ServiceProviderMethods
- Defined in:
- lib/inflect/director.rb
Overview
The class in charge of managing the access and selection of the services.
Instance Method Summary collapse
-
#handle(words) ⇒ Object
Finds the first Service that is able to handle the request and lets him do the work.
- #reload ⇒ Object
Methods included from ServiceProviderMethods
Instance Method Details
#handle(words) ⇒ Object
Finds the first Service that is able to handle the request and lets him do the work.
14 15 16 17 18 19 20 21 22 |
# File 'lib/inflect/director.rb', line 14 def handle(words) request = Inflect::Request.new(words) selected_service = select_service(request) if selected_service.nil? raise "No service can respond to #{request.keyword}" else selected_service.serve(request) end end |
#reload ⇒ Object
24 25 26 |
# File 'lib/inflect/director.rb', line 24 def reload service_provider.reload end |