-
-
Save thomas-holmes/cb589b10239757d399c8 to your computer and use it in GitHub Desktop.
This file contains 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
t = Time.now | |
case t | |
when defined?(String) && String then puts 'string' | |
when defined?(DateTime) && DateTime then puts 'datetime' | |
when defined?(Time) && Time then puts 'time' | |
else puts 'wtf' | |
end | |
#=> thomas@e3 ~/Code/test $ ruby test.rb | |
#=> time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment