Created
January 20, 2014 21:04
-
-
Save jacobsimeon/8529105 to your computer and use it in GitHub Desktop.
Check if a number is an integer with Numeric#whole?.
This file contains hidden or 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 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