From 6ae24abd5bbf106334af8962a8e269d31ea12e8b Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Sat, 16 Jun 2012 21:59:14 +0200 Subject: [PATCH] Revert "Change redundant String#replace..." This reverts commit a4e37948a20e73ba1de3f5c8e723f05d9f0c7da3. String#clear is a method that was introduced in Ruby 1.9, it's not available in 1.8. --- lib/pry.rb | 2 +- lib/pry/default_commands/editing.rb | 2 +- lib/pry/pry_instance.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pry.rb b/lib/pry.rb index 0b13970b..e1fadffa 100644 --- a/lib/pry.rb +++ b/lib/pry.rb @@ -104,7 +104,7 @@ class Pry DEFAULT_CONTROL_D_HANDLER = proc do |eval_string, _pry_| if !eval_string.empty? # clear input buffer - eval_string.clear + eval_string.replace("") elsif _pry_.binding_stack.one? # ^D at top-level breaks out of loop _pry_.binding_stack.clear diff --git a/lib/pry/default_commands/editing.rb b/lib/pry/default_commands/editing.rb index 237d7cb4..ef88dbf4 100644 --- a/lib/pry/default_commands/editing.rb +++ b/lib/pry/default_commands/editing.rb @@ -10,7 +10,7 @@ class Pry create_command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop.", :use_prefix => false do def process output.puts "Input buffer cleared!" - eval_string.clear + eval_string.replace("") end end diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index bfa8f5d3..fbc9ec68 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -348,7 +348,7 @@ class Pry # from within Readline. rescue Interrupt output.puts "" - eval_string.clear + eval_string.replace("") return end