Created
June 8, 2010 15:44
-
-
Save rsl/430212 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
>> case "String".class | |
>> when String | |
>> puts "I'm a string" | |
>> else | |
?> puts "I can't tell what I am" | |
>> end | |
I can't tell what I am |
irb(main):002:0> "string".class === String
=> false
interesting. i think i've run into this before but couldn't remember the solution.
Whoops ;)
@raggi String === "string".class is also wrong. It should be String === "string".
@raggi - ooops, misread your comment. sorry about that :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
case
calls .class on the original object when you give it a class in awhen
statement.