1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #599 from kyrylo/change-replace-to-clear

Change redundant String#replace to String#clear
This commit is contained in:
Yorick Peterse 2012-06-16 12:46:02 -07:00
commit 7cd1e651a3
3 changed files with 3 additions and 3 deletions

View file

@ -104,7 +104,7 @@ class Pry
DEFAULT_CONTROL_D_HANDLER = proc do |eval_string, _pry_| DEFAULT_CONTROL_D_HANDLER = proc do |eval_string, _pry_|
if !eval_string.empty? if !eval_string.empty?
# clear input buffer # clear input buffer
eval_string.replace("") eval_string.clear
elsif _pry_.binding_stack.one? elsif _pry_.binding_stack.one?
# ^D at top-level breaks out of loop # ^D at top-level breaks out of loop
_pry_.binding_stack.clear _pry_.binding_stack.clear

View file

@ -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 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 def process
output.puts "Input buffer cleared!" output.puts "Input buffer cleared!"
eval_string.replace("") eval_string.clear
end end
end end

View file

@ -348,7 +348,7 @@ class Pry
# from within Readline. # from within Readline.
rescue Interrupt rescue Interrupt
output.puts "" output.puts ""
eval_string.replace("") eval_string.clear
return return
end end