Created
December 9, 2010 11:29
-
-
Save kronos/734627 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class X < String | |
def to_s | |
"#{self}" # <-- to_s, to_s... | |
end | |
end | |
X.new('a').to_s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
class Q < String
def to_s
'a'
end
def to_str
'b'
end
end
puts Q.new('zzz')
on both 1.9.2 and 1.8.7 output will be 'zzz'. on rubinius - 'a'