Skip to content

Conversation

the-spectator
Copy link
Contributor

This PR implements #to_s as an alias for #inspect. Previously, #to_s was printing File which is a bit misleading.

Before:

t = Tempfile.new
t.to_s #=> #<File:0x0000000108d0c498>

After:

t = Tempfile.new
t.to_s #=> #<Tempfile:/var/folders/rh/2d2lzkfn22sfmx5227bww_km0000gn/T/20230501-30515-b2tr67>

@the-spectator the-spectator changed the title Alias #to_s to #inspect Alias Tempfile#to_s to Tempfile#inspect May 1, 2023
@the-spectator
Copy link
Contributor Author

Ping for maintainers. Please help to suggest any improvements so I can make the patch acceptable.
cc: @hsbt

@hsbt hsbt merged commit 8d6b865 into ruby:master Dec 5, 2023
@the-spectator the-spectator deleted the improve_to_s branch December 5, 2023 07:58
@the-spectator
Copy link
Contributor Author

the-spectator commented Dec 5, 2023

Thank you for review and the merge 🙏 @hsbt !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants