Permalink
Browse files

removed unnecessary pry_command? method from command_processor.rb. An…

…d removed #clear singleton method on val and eval_string, converted to #replace
  • Loading branch information...
1 parent 6a60955 commit 9abb4db3e2bd06c8e9ec0adc04357f8fbd9d9a5b @banister committed May 31, 2011
Showing with 4 additions and 18 deletions.
  1. +3 −17 lib/pry/command_processor.rb
  2. +1 −1 lib/pry/default_commands/input.rb
@@ -16,14 +16,6 @@ def initialize(pry_instance)
# @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 @@ def interpolate_string(str, target)
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 @@ def command_matched(val)
# 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
+ command, captures, pos = command_matched(val)
# no command was matched, so return to caller
- return if !pry_command?(val)
-
- command, captures, pos = command_matched(val)
+ 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 @@ def execute_command(target, command, options, *args)
ret = commands.run_command(context, command, *args)
# Tick, tock, im getting rid of this shit soon.
- options[:val].clear
+ options[:val].replace("")
ret
end
@@ -5,7 +5,7 @@ module DefaultCommands
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

0 comments on commit 9abb4db

Please sign in to comment.