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
-
#current_route ⇒ Arkaan::Monitoring::Route
The currently requested API route, used to see inside the block if the route is premium or not, authenticated or not.
Instance Method Details
#current_route ⇒ Arkaan::Monitoring::Route
The currently requested API route, used to see inside the block if the route is premium or not, authenticated or not.
12 13 14 15 16 17 18 |
# File 'lib/virtuatable/helpers/routes.rb', line 12 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 |