Does Rails 3 or Ruby have a built-in way to check if a variable is an integer?
For example,
1.is_an_int #=> true \"dadadad@asdasd.net\".is_an_int
A more "duck typing" way is to use respond_to? this way "integer-like" or "string-like" classes can also be used
respond_to?
if(s.respond_to?(:match) && s.match(".com")){ puts "It's a .com" else puts "It's not" end