Skip to content

Instantly share code, notes, and snippets.

@jacobsimeon
Created January 20, 2014 21:04
Show Gist options
  • Save jacobsimeon/8529105 to your computer and use it in GitHub Desktop.
Save jacobsimeon/8529105 to your computer and use it in GitHub Desktop.
Check if a number is an integer with Numeric#whole?.
class Numeric
# works for Float, Integer and BigDecimal
def whole?
self % 0 == 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment