ruby / tempfile

A utility class for managing temporary files.
Other
29 stars 10 forks source link

Alias Tempfile#to_s to Tempfile#inspect #19

Closed the-spectator closed 9 months ago

the-spectator commented 1 year ago

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 commented 1 year ago

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

the-spectator commented 9 months ago

Thank you for review and the merge 🙏 @hsbt !