Class: Vundabar::Routing::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/vundabar/routing/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, klass_and_method) ⇒ Route

Returns a new instance of Route.



5
6
7
8
# File 'lib/vundabar/routing/route.rb', line 5

def initialize(request, klass_and_method)
  @request = request
  @controller_name, @action = klass_and_method
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



4
5
6
# File 'lib/vundabar/routing/route.rb', line 4

def action
  @action
end

#controller_nameObject (readonly)

Returns the value of attribute controller_name.



4
5
6
# File 'lib/vundabar/routing/route.rb', line 4

def controller_name
  @controller_name
end

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/vundabar/routing/route.rb', line 4

def request
  @request
end

Instance Method Details

#dispatcherObject



10
11
12
13
14
15
# File 'lib/vundabar/routing/route.rb', line 10

def dispatcher
  controller = controller_name.to_constant.new(request)
  controller.send(action)
  controller.render(action) unless controller.get_response
  controller.get_response
end