Created
August 17, 2018 14:05
-
-
Save cdesch/139075fd3c35899b3f2bac3040b09b40 to your computer and use it in GitHub Desktop.
Rails Numeric
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
def is_numeric?(obj) | |
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true | |
end | |
def is_not_numeric?(obj) | |
!is_numeric?(obj) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment