Class: Reactive::Mvc::Dispatcher

Inherits:
Dispatcher::Base
  • Object
show all
Defined in:
lib/reactive-mvc/dispatcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.candidate?(request) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/reactive-mvc/dispatcher.rb', line 6

def candidate?(request)
  request.params[:dispatcher] == :mvc
end

.instance_for(request) ⇒ Object



9
10
11
# File 'lib/reactive-mvc/dispatcher.rb', line 9

def instance_for(request)
  @@singleton ||= new
end

Instance Method Details

#dispatch(request) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/reactive-mvc/dispatcher.rb', line 14

def dispatch(request)
  self.request = request
  controller = recognize(request).new
  self.response = Response.new
  
  log_processing
  controller.process(request, response)

  handle_response
end