Project

General

Profile

Feature #20703

Updated by sebyx07 (Sebastian Buza) 3 months ago

# Description 
 Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string` 

 IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps. 
 * Also added .to_str 

 That way you can also do interpolation easily 
 ```ruby 
 my_sio = StringIO.new('my string') 

 # current 
 puts "value: #{my_sio}" # value: #<StringIO:0x0000764bba88eec0> 

 # after 
 puts "value: #{my_sio}" # value: my string 
 ``` 

 - issue: https://github.com/ruby/stringio/issues/102 
 - pr: https://github.com/ruby/stringio/pull/103

Back