From b2dcfba7611a89f88813748e9825e7d5f87e20fe Mon Sep 17 00:00:00 2001 From: Rob Gleeson Date: Sun, 5 Jun 2011 23:48:15 +0100 Subject: [PATCH] Don't cause warnings, Pry. --- lib/pry/command_processor.rb | 2 +- lib/pry/default_commands/input.rb | 6 +++--- lib/pry/default_commands/shell.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pry/command_processor.rb b/lib/pry/command_processor.rb index 697c9077..32a31222 100644 --- a/lib/pry/command_processor.rb +++ b/lib/pry/command_processor.rb @@ -46,7 +46,7 @@ class Pry # @param [String] val The line of input. # @return [Array] The command data and arg string pair def command_matched(val) - _, cmd_data = commands.commands.find do |name, cmd_data| + _, cmd_data = commands.commands.find do |name, data| /^#{convert_to_regex(name)}(?!\S)/ =~ val end diff --git a/lib/pry/default_commands/input.rb b/lib/pry/default_commands/input.rb index 12a67174..ac6accfa 100644 --- a/lib/pry/default_commands/input.rb +++ b/lib/pry/default_commands/input.rb @@ -12,8 +12,8 @@ class Pry render_output(false, 0, Pry.color ? CodeRay.scan(eval_string, :ruby).term : eval_string) end - command /amend-line-?(\d+)?/, "Experimental amend-line, where the N in amend-line-N represents line to replace. Aliases: %N", - :interpolate => false, :listing => "amend-line-N" do |line_number, replacement_line| + command(/amend-line-?(\d+)?/, "Experimental amend-line, where the N in amend-line-N represents line to replace. Aliases: %N", + :interpolate => false, :listing => "amend-line-N") do |line_number, replacement_line| replacement_line = "" if !replacement_line input_array = eval_string.each_line.to_a line_num = line_number ? line_number.to_i : input_array.size - 1 @@ -21,7 +21,7 @@ class Pry eval_string.replace input_array.join end - alias_command /%(\d+)?/, /amend-line-?(\d+)?/, "" + alias_command(/%(\d+)?/, /amend-line-?(\d+)?/, "") command "hist", "Show and replay Readline history. Type `hist --help` for more info." do |*args| Slop.parse(args) do |opt| diff --git a/lib/pry/default_commands/shell.rb b/lib/pry/default_commands/shell.rb index cd01056a..70f2bae0 100644 --- a/lib/pry/default_commands/shell.rb +++ b/lib/pry/default_commands/shell.rb @@ -3,7 +3,7 @@ class Pry Shell = Pry::CommandSet.new do - command /\.(.*)/, "All text following a '.' is forwarded to the shell.", :listing => "." do |cmd| + command(/\.(.*)/, "All text following a '.' is forwarded to the shell.", :listing => ".") do |cmd| if cmd =~ /^cd\s+(.+)/i begin Dir.chdir File.expand_path($1)