Skip to content

Instantly share code, notes, and snippets.

@fxposter
Created February 11, 2014 20:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fxposter/8943222 to your computer and use it in GitHub Desktop.
Save fxposter/8943222 to your computer and use it in GitHub Desktop.
class A
def to_s
'A1'
end
def to_str
'A2'
end
end
class B
def to_str
'B'
end
end
class C
def to_s
'C'
end
end
class D
end
def check
yield
rescue => e
e
end
check { "hello, #{A.new}" } # ?
check { "hello, " + A.new } # ?
check { "hello, " << A.new } # ?
check { "hello, #{B.new}" } # ?
check { "hello, " + B.new } # ?
check { "hello, " << B.new } # ?
check { "hello, #{C.new}" } # ?
check { "hello, " + C.new } # ?
check { "hello, " << C.new } # ?
check { "hello, #{D.new}" } # ?
check { "hello, " + D.new } # ?
check { "hello, " << D.new } # ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment