Class: RoadForest::TestSupport::DispatcherFacade

Inherits:
BasicObject
Defined in:
lib/roadforest/test-support/dispatcher-facade.rb

Instance Method Summary collapse

Constructor Details

#initialize(dispatcher) ⇒ DispatcherFacade

Returns a new instance of DispatcherFacade.



9
10
11
# File 'lib/roadforest/test-support/dispatcher-facade.rb', line 9

def initialize(dispatcher)
  @dispatcher = dispatcher
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
# File 'lib/roadforest/test-support/dispatcher-facade.rb', line 13

def method_missing(method, *args, &block)
  @dispatcher.__send__(method, *args, &block)
end

Instance Method Details

#dispatch(request, response) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/roadforest/test-support/dispatcher-facade.rb', line 17

def dispatch(request, response)
  if resource = @dispatcher.find_resource(request, response)
    FSM.new(resource, request, response).run
  else
    ::Webmachine.render_error(404, request, response)
  end
end