Class: ActionDispatch::Routing::RouteWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/action_dispatch/routing/inspector.rb

Instance Method Summary collapse

Instance Method Details

#actionObject



39
40
41
# File 'lib/action_dispatch/routing/inspector.rb', line 39

def action
  parts.include?(:action) ? ":action" : requirements[:action]
end

#constraintsObject



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

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

#controllerObject



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

def controller
  parts.include?(:controller) ? ":controller" : requirements[:controller]
end

#endpointObject



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

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

#engine?Boolean

Returns:

  • (Boolean)


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

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

#internal?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/action_dispatch/routing/inspector.rb', line 43

def internal?
  internal
end

#nameObject



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

def name
  super.to_s
end

#pathObject



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

def path
  super.spec.to_s
end

#rack_appObject



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

def rack_app
  app.app
end

#reqsObject



27
28
29
30
31
32
33
# File 'lib/action_dispatch/routing/inspector.rb', line 27

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