Class: FitApi::Router::Route
- Inherits:
-
Object
- Object
- FitApi::Router::Route
- Defined in:
- lib/fit_api/router/route.rb
Instance Method Summary collapse
-
#initialize(verb, path, options = {}) ⇒ Route
constructor
A new instance of Route.
- #invoke(env) ⇒ Object
- #match?(path) ⇒ Boolean
Constructor Details
#initialize(verb, path, options = {}) ⇒ Route
Returns a new instance of Route.
16 17 18 19 20 21 22 23 |
# File 'lib/fit_api/router/route.rb', line 16 def initialize(verb, path, = {}) @verb = verb @path = path @controller = get_controller() @action = get_action() require_controller end |
Instance Method Details
#invoke(env) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/fit_api/router/route.rb', line 25 def invoke(env) request = Request.new(env) params = build_params(request) controller = Object.const_get("#{@controller.to_s.capitalize}Controller").new(request, params) controller.invoke(@action) rescue Halt controller.response end |