Class: Grape::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/grape/route.rb

Overview

A compiled route for inspection.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Route

Returns a new instance of Route.



6
7
8
# File 'lib/grape/route.rb', line 6

def initialize(options = {})
  @options = options || {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *arguments) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/grape/route.rb', line 10

def method_missing(method_id, *arguments)
  if match = /route_([_a-zA-Z]\w*)/.match(method_id.to_s)
    @options[match.captures.last.to_sym]
  else
    super
  end
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/grape/route.rb', line 18

def to_s
  "version=#{route_version}, method=#{route_method}, path=#{route_path}"
end