Class: Tuttle::Presenters::ActionDispatch::Routing::RouteWrapper

Inherits:
ActionDispatch::Routing::RouteWrapper
  • Object
show all
Defined in:
lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#actionObject



20
21
22
# File 'lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb', line 20

def action
  super if uses_dispatcher?
end

#controllerObject



16
17
18
# File 'lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb', line 16

def controller
  super if uses_dispatcher?
end

#endpoint_or_app_nameObject



8
9
10
11
12
13
14
# File 'lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb', line 8

def endpoint_or_app_name
  if uses_dispatcher?
    endpoint
  else
    rack_app.is_a?(Class) ? rack_app : rack_app.class
  end
end

#route_problemObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb', line 28

def route_problem
  # TODO: this does not handle ImplicitRender actions where the method does not exist but the template does
  return @route_problem if defined?(@route_problem)
  @route_problem =
    if controller_klass
      if requirements[:action] && controller_klass.action_methods.exclude?(action)
        'Action does not exist'
      end
    elsif requirements[:controller]
      'Controller does not exist'
    end
end

#uses_dispatcher?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb', line 24

def uses_dispatcher?
  rack_app.respond_to?(:dispatcher?)
end