class Grape::Route

A compiled route for inspection.

Public Class Methods

new(options = {}) click to toggle source

@api private

# File lib/grape/route.rb, line 5
def initialize(options = {})
  @options = options || {}
end

Public Instance Methods

method_missing(method_id, *arguments) click to toggle source

@api private

Calls superclass method
# File lib/grape/route.rb, line 10
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
to_s() click to toggle source

Generate a short, human-readable representation of this route.

# File lib/grape/route.rb, line 20
def to_s
  "version=#{route_version}, method=#{route_method}, path=#{route_path}"
end

Private Instance Methods

to_ary() click to toggle source

This is defined so that certain Ruby methods which attempt to call to_ary on objects, e.g. Array#join, will not hit method_missing.

# File lib/grape/route.rb, line 28
def to_ary
  nil
end