Class: Redwing::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/redwing/dispatcher.rb

Instance Method Summary collapse

Instance Method Details

#call(route, request, path_params = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/redwing/dispatcher.rb', line 7

def call(route, request, path_params = {})
  if route[:handler]
    RouteContext.new(request).instance_eval(&route[:handler])
  elsif route[:to]
    controller_class, action = resolve(route[:to])
    controller_class.new(request, path_params).public_send(action)
  end
end