Skip to content

Instantly share code, notes, and snippets.

@cdesch
Created August 17, 2018 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdesch/139075fd3c35899b3f2bac3040b09b40 to your computer and use it in GitHub Desktop.
Save cdesch/139075fd3c35899b3f2bac3040b09b40 to your computer and use it in GitHub Desktop.
Rails Numeric
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