From: sawadatsuyoshi@... Date: 2016-03-14T17:36:02+00:00 Subject: [ruby-core:74301] [Ruby trunk Bug#12174] Interpolation ignores `to_s` (and `inspect`) when `to_s` is defined to `nil`. Issue #12174 has been reported by Tsuyoshi Sawada. ---------------------------------------- Bug #12174: Interpolation ignores `to_s` (and `inspect`) when `to_s` is defined to `nil`. https://bugs.ruby-lang.org/issues/12174 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- When `to_s` is defined to return `nil`, interpolation prints the original inspection. ~~~RUBY class A def to_s; end end puts "#{A.new}" # => # ~~~ It even ignores an overwritten `inspect` definition. ~~~RUBY class A def to_s; end def inspect; "foo" end end puts "#{A.new}" # => # ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: