Skip to content

Instantly share code, notes, and snippets.

@techdubb
Created January 29, 2015 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techdubb/8ea7151cff2985c39dfa to your computer and use it in GitHub Desktop.
Save techdubb/8ea7151cff2985c39dfa to your computer and use it in GitHub Desktop.
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