Module: Virtuatable::Helpers::Routes
- Included in:
- Controllers::Base
- Defined in:
- lib/virtuatable/helpers/routes.rb
Overview
This module provides the #current_route method to get the current Arkaan::Monitoring::Route object from whithin sinatra routes.
Instance Method Summary collapse
Instance Method Details
#current_route ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/virtuatable/helpers/routes.rb', line 9 def current_route splitted = request.env['sinatra.route'].split(' ') verb = splitted.first.downcase self.class.api_routes.find do |route| route.verb == verb && route.path == splitted.last end end |