class Tuttle::Presenters::ActionDispatch::Routing::RouteWrapper

Public Instance Methods

action() click to toggle source
Calls superclass method
# File lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb, line 20
def action
  super if uses_dispatcher?
end
controller() click to toggle source
Calls superclass method
# File lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb, line 16
def controller
  super if uses_dispatcher?
end
endpoint_or_app_name() click to toggle source
# 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_problem() click to toggle source
# 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?() click to toggle source
# File lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb, line 24
def uses_dispatcher?
  rack_app.respond_to?(:dispatcher?)
end

Private Instance Methods

controller_klass() click to toggle source
# File lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb, line 43
def controller_klass
  return @controller_klass if defined?(@controller_klass)
  @controller_klass =
    if requirements[:controller].present?
      begin
        controller_reference(controller)
      rescue NameError
        # No class is defined for the give route
        # puts "NameError for #{requirements[:controller]}"
        nil
      end
    end
end
controller_reference(controller_param) click to toggle source

Copied from <actionpack>/lib/action_dispatch/routing/route_set.rb

# File lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb, line 58
def controller_reference(controller_param)
  const_name = "#{controller_param.camelize}Controller"
  ::ActiveSupport::Dependencies.constantize(const_name)
end