Class: Vundabar::Routing::Route
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller_name ⇒ Object
readonly
Returns the value of attribute controller_name.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #dispatcher ⇒ Object
-
#initialize(request, klass_and_method) ⇒ Route
constructor
A new instance of Route.
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
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/vundabar/routing/route.rb', line 4 def action @action end |
#controller_name ⇒ Object (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 |
#request ⇒ Object (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
#dispatcher ⇒ Object
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 |