Skip to content

Instantly share code, notes, and snippets.

@chrisbloom7
Created March 18, 2013 18:37
Show Gist options
  • Save chrisbloom7/5189619 to your computer and use it in GitHub Desktop.
Save chrisbloom7/5189619 to your computer and use it in GitHub Desktop.
Determine if an object represents an integer
class Object
def is_integer?
!!(check = Integer(self) rescue false) && check.try(:to_s) == self.try(:to_s)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment