class PryRails::RecognizePath

Public Instance Methods

options(opt) click to toggle source
# File lib/pry-rails/commands/recognize_path.rb, line 15
def options(opt)
  opt.on :m, :method, "Methods", :argument => true
end
process(path) click to toggle source
# File lib/pry-rails/commands/recognize_path.rb, line 19
def process(path)
  method = (opts.m? ? opts[:m] : :get)
  routes = Rails.application.routes

  begin
    info = routes.recognize_path("http://#{path}", :method => method)
  rescue ActionController::UnknownHttpMethod
    output.puts "Unknown HTTP method: #{method}"
  rescue ActionController::RoutingError => e
    output.puts e
  end

  output.puts Pry::Helpers::BaseHelpers.colorize_code(info)
end