Class: PryRails::RecognizePath
- Inherits:
-
Pry::ClassCommand
- Object
- Pry::ClassCommand
- PryRails::RecognizePath
- Defined in:
- lib/pry-rails/commands/recognize_path.rb
Instance Method Summary collapse
Instance Method Details
#options(opt) ⇒ Object
15 16 17 |
# File 'lib/pry-rails/commands/recognize_path.rb', line 15 def (opt) opt.on :m, :method, "Methods", :argument => true end |
#process(path) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |