123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::RouteWrapper

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, SimpleDelegator
Instance Chain:
self, SimpleDelegator
Inherits: SimpleDelegator
  • ::Object
Defined in: actionpack/lib/action_dispatch/routing/inspector.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#engine?Boolean (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 68

def engine?
  rack_app.respond_to?(:routes)
end

#internal?Boolean (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 64

def internal?
  controller.to_s =~ %r{\Arails/(info|mailers|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}\z}
end

Instance Method Details

#action

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 60

def action
  requirements[:action] || ':action'
end

#constraints

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 11

def constraints
  requirements.except(:controller, :action)
end

#controller

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 56

def controller
  requirements[:controller] || ':controller'
end

#endpoint

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 7

def endpoint
  app.dispatcher? ? "#{controller}##{action}" : rack_app.inspect
end

#json_regexp

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 35

def json_regexp
  str = regexp.inspect.
        sub('\\A' , '^').
        sub('\\Z' , '$').
        sub('\\z' , '$').
        sub(/^\// , '').
        sub(/\/[a-z]*$/ , '').
        gsub(/\(\?#.+\)/ , '').
        gsub(/\(\?-\w+:/ , '(').
        gsub(/\s/ , '')
  Regexp.new(str).source
end

#name

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 27

def name
  super.to_s
end

#path

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 23

def path
  super.spec.to_s
end

#rack_app

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 15

def rack_app
  app.app
end

#regexp

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 31

def regexp
  __getobj__.path.to_regexp
end

#reqs

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 48

def reqs
  @reqs ||= begin
    reqs = endpoint
    reqs += " #{constraints}" unless constraints.empty?
    reqs
  end
end

#verb

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 19

def verb
  super.source.gsub(/[$^]/, '')
end