class Kafo::DataTypes::Numeric

Public Instance Methods

typecast(value) click to toggle source
# File lib/kafo/data_types/numeric.rb, line 4
def typecast(value)
  value =~ /\d+/ ? value.to_f : value
end
valid?(input, errors = []) click to toggle source
# File lib/kafo/data_types/numeric.rb, line 8
def valid?(input, errors = [])
  errors << "#{input.inspect} is not a valid number" unless input.is_a?(::Integer) || input.is_a?(::Float)
  return errors.empty?
end