From 9abb4db3e2bd06c8e9ec0adc04357f8fbd9d9a5b Mon Sep 17 00:00:00 2001 From: John Mair Date: Tue, 31 May 2011 20:45:42 +1200 Subject: [PATCH] removed unnecessary pry_command? method from command_processor.rb. And removed #clear singleton method on val and eval_string, converted to #replace --- lib/pry/command_processor.rb | 22 ++++------------------ lib/pry/default_commands/input.rb | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/pry/command_processor.rb b/lib/pry/command_processor.rb index 73bdec12..697c9077 100644 --- a/lib/pry/command_processor.rb +++ b/lib/pry/command_processor.rb @@ -16,14 +16,6 @@ class Pry # @param [String] val The string passed in from the Pry prompt. # @return [Boolean] Whether the string is a valid command. def valid_command?(val) - pry_command?(val) - end - - - # Is the string a valid pry command? - # @param [String] val The string passed in from the Pry prompt. - # @return [Boolean] Whether the string is a valid Pry command. - def pry_command?(val) !!(command_matched(val)[0]) end @@ -48,7 +40,6 @@ class Pry target.eval(dumped_str) end - # Determine whether a Pry command was matched and return command data # and argument string. # This method should not need to be invoked directly. @@ -72,18 +63,13 @@ class Pry # multi-line input. # @param [Binding] target The receiver of the commands. def process_commands(val, eval_string, target) - def val.clear() replace("") end - def eval_string.clear() replace("") end - - # no command was matched, so return to caller - return if !pry_command?(val) - command, captures, pos = command_matched(val) + # no command was matched, so return to caller + return if !command + val.replace interpolate_string(val, target) if command.options[:interpolate] - arg_string = val[pos..-1].strip - args = arg_string ? Shellwords.shellwords(arg_string) : [] options = { @@ -121,7 +107,7 @@ class Pry ret = commands.run_command(context, command, *args) # Tick, tock, im getting rid of this shit soon. - options[:val].clear + options[:val].replace("") ret end diff --git a/lib/pry/default_commands/input.rb b/lib/pry/default_commands/input.rb index b4896cdf..12a67174 100644 --- a/lib/pry/default_commands/input.rb +++ b/lib/pry/default_commands/input.rb @@ -5,7 +5,7 @@ class Pry command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop." do output.puts "Input buffer cleared!" - eval_string.clear + eval_string.replace("") end command "show-input", "Show the current eval_string" do