class String

Extending the class String to perform checks on string to get if is a number

Public Instance Methods

numeric?() click to toggle source
# File lib/is_numeric.rb, line 6
def numeric?
  !(self !~ /^-?\d+(\.\d*)?$/)
end