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.



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

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



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

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

Instance Method Details

#dispatch(request, response) ⇒ Object



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

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