From: "Dan0042 (Daniel DeLorme) via ruby-core" Date: 2024-08-28T01:19:16+00:00 Subject: [ruby-core:118971] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s Issue #20703 has been updated by Dan0042 (Daniel DeLorme). +1 Might also consider adding #to_str, as I think it makes sense to consider StringIO to be a kind of string. ---------------------------------------- Feature #20703: Alias StringIO#string to StringIO#to_s https://bugs.ruby-lang.org/issues/20703#change-109544 * Author: sebyx07 (Sebastian Buza) * Status: Open ---------------------------------------- # 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. That way you can also do interpolation easily ```ruby my_sio = StringIO.new('my string') # current puts "value: #{my_sio}" # value: # # after puts "value: #{my_sio}" # value: my string ``` - issue: https://github.com/ruby/stringio/issues/102 - pr: https://github.com/ruby/stringio/pull/103 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/