Class: ActionDispatch::Routing::RouteWrapper
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ActionDispatch::Routing::RouteWrapper
- Defined in:
- lib/action_dispatch/routing/inspector.rb
Instance Method Summary collapse
- #action ⇒ Object
- #constraints ⇒ Object
- #controller ⇒ Object
- #endpoint ⇒ Object
- #engine? ⇒ Boolean
- #internal? ⇒ Boolean
- #json_regexp ⇒ Object
- #name ⇒ Object
- #path ⇒ Object
- #rack_app ⇒ Object
- #regexp ⇒ Object
- #reqs ⇒ Object
- #verb ⇒ Object
Instance Method Details
#action ⇒ Object
60 61 62 |
# File 'lib/action_dispatch/routing/inspector.rb', line 60 def action requirements[:action] || ':action' end |
#constraints ⇒ Object
11 12 13 |
# File 'lib/action_dispatch/routing/inspector.rb', line 11 def constraints requirements.except(:controller, :action) end |
#controller ⇒ Object
56 57 58 |
# File 'lib/action_dispatch/routing/inspector.rb', line 56 def controller requirements[:controller] || ':controller' end |
#endpoint ⇒ Object
7 8 9 |
# File 'lib/action_dispatch/routing/inspector.rb', line 7 def endpoint app.dispatcher? ? "#{controller}##{action}" : rack_app.inspect end |
#engine? ⇒ Boolean
68 69 70 |
# File 'lib/action_dispatch/routing/inspector.rb', line 68 def engine? rack_app.respond_to?(:routes) end |
#internal? ⇒ Boolean
64 65 66 |
# File '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 |
#json_regexp ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File '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 ⇒ Object
27 28 29 |
# File 'lib/action_dispatch/routing/inspector.rb', line 27 def name super.to_s end |
#path ⇒ Object
23 24 25 |
# File 'lib/action_dispatch/routing/inspector.rb', line 23 def path super.spec.to_s end |
#rack_app ⇒ Object
15 16 17 |
# File 'lib/action_dispatch/routing/inspector.rb', line 15 def rack_app app.app end |
#regexp ⇒ Object
31 32 33 |
# File 'lib/action_dispatch/routing/inspector.rb', line 31 def regexp __getobj__.path.to_regexp end |
#reqs ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/action_dispatch/routing/inspector.rb', line 48 def reqs @reqs ||= begin reqs = endpoint reqs += " #{constraints}" unless constraints.empty? reqs end end |
#verb ⇒ Object
19 20 21 |
# File 'lib/action_dispatch/routing/inspector.rb', line 19 def verb super.source.gsub(/[$^]/, '') end |