Class: ActionDispatch::Routing::RouteWrapper

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#actionObject



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

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

#constraintsObject



28
29
30
# File 'lib/action_dispatch/routing/inspector.rb', line 28

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

#controllerObject



52
53
54
# File 'lib/action_dispatch/routing/inspector.rb', line 52

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

#endpointObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/action_dispatch/routing/inspector.rb', line 17

def endpoint
  case
  when app.dispatcher?
    "#{controller}##{action}"
  when rack_app.is_a?(Proc)
    "Inline handler (Proc/Lambda)"
  else
    rack_app.inspect
  end
end

#engine?Boolean

Returns:

  • (Boolean)


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

def engine?
  app.engine?
end

#internal?Boolean

Returns:

  • (Boolean)


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

def internal?
  internal
end

#matches_filter?(filter, value) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches_filter?(filter, value)
  return __getobj__.path.match(value) if filter == :exact_path_match

  value.match?(public_send(filter))
end

#nameObject



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

def name
  super.to_s
end

#pathObject



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

def path
  super.spec.to_s
end

#rack_appObject



32
33
34
# File 'lib/action_dispatch/routing/inspector.rb', line 32

def rack_app
  app.rack_app
end

#reqsObject



44
45
46
47
48
49
50
# File 'lib/action_dispatch/routing/inspector.rb', line 44

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