Skip to content

Instantly share code, notes, and snippets.

@cdesch cdesch/numeric.rb
Created Aug 17, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.