mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix behavior of Pry::Output#puts
This implementation of puts didn't behave correctly in the presence of multiple arguments or arguments that are Arrays. I changed it to match the documented behavior of IO#puts, but we might still be missing some subtleties.
This commit is contained in:
parent
1fb76350d1
commit
cb2f8c08f6
1 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
class Pry
|
||||
class Output
|
||||
attr_reader :_pry_
|
||||
|
@ -7,8 +6,16 @@ class Pry
|
|||
@_pry_ = _pry_
|
||||
end
|
||||
|
||||
def puts(str)
|
||||
print "#{str.chomp}\n"
|
||||
def puts(*objs)
|
||||
return print "\n" if objs.empty?
|
||||
|
||||
objs.each do |obj|
|
||||
if obj.is_a?(Array)
|
||||
puts(*obj)
|
||||
else
|
||||
print "#{obj.to_s.chomp}\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def print(str)
|
||||
|
|
Loading…
Reference in a new issue