Is my assumption correct that Ruby does not call the to_s
or to_str
method when interpreting a String
object during string-interpolation?
a = "Hallo"class String def to_s"Servus" endenddef a.to_s"Servus"endputs "Hier sagt man #{a}"
=> Hier sagt man Hallo
Is it more efficient to check if an object is a String
than to simply call the to_s
method?