Created
January 29, 2015 01:31
-
-
Save techdubb/8ea7151cff2985c39dfa 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
class String | |
def guess_type | |
if self.to_i.to_s == self | |
return Integer | |
elsif self.to_f.to_s == self | |
return Float | |
elsif self.downcase == "true" || self.downcase == "false" | |
return Boolean | |
end | |
return String | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment