Actions
Bug #12174
closedInterpolation ignores `to_s` (and `inspect`) when `to_s` is defined to `nil`.
Bug #12174:
Interpolation ignores `to_s` (and `inspect`) when `to_s` is defined to `nil`.
Description
When to_s is defined to return nil, interpolation prints the original inspection.
class A
def to_s; end
end
puts "#{A.new}" # => #<A:0x007f4edf19d720>
It even ignores an overwritten inspect definition.
class A
def to_s; end
def inspect; "foo" end
end
puts "#{A.new}" # => #<A:0x007f8176c09050>
Actions