mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
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 <kyrylosilin@gmail.com>
This commit is contained in:
parent
3bfd65d5d8
commit
a4e37948a2
3 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ class Pry
|
|||
# from within Readline.
|
||||
rescue Interrupt
|
||||
output.puts ""
|
||||
eval_string.replace("")
|
||||
eval_string.clear
|
||||
return
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue