From a4e37948a20e73ba1de3f5c8e723f05d9f0c7da3 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Sat, 16 Jun 2012 21:25:27 +0300 Subject: [PATCH] Change redundant String#replace to String#clear "foo".clear does the same as "foo".replace(""). But the former is more concise. Signed-off-by: Kyrylo Silin --- 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 e1fadffa..0b13970b 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.replace("") + eval_string.clear 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 e16c8aef..5d0099b8 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.replace("") + eval_string.clear end end diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index fbc9ec68..bfa8f5d3 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.replace("") + eval_string.clear return end