Class: Grape::Route
- Inherits:
-
Object
- Object
- Grape::Route
- Defined in:
- lib/grape/route.rb
Overview
A compiled route for inspection.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Route
constructor
A new instance of Route.
- #method_missing(method_id, *arguments) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Route
Returns a new instance of Route.
4 5 6 |
# File 'lib/grape/route.rb', line 4 def initialize( = {}) @options = || {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *arguments) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/grape/route.rb', line 8 def method_missing(method_id, *arguments) match = /route_([_a-zA-Z]\w*)/.match(method_id.to_s) if match @options[match.captures.last.to_sym] else super end end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/grape/route.rb', line 17 def to_s "version=#{route_version}, method=#{route_method}, path=#{route_path}" end |