method

parse_as_number

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: ActiveModel::Validations::NumericalityValidator
parse_as_number(raw_value) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/validations/numericality.rb, line 89
      def parse_as_number(raw_value)
        if raw_value.is_a?(Float)
          raw_value.to_d
        elsif raw_value.is_a?(Numeric)
          raw_value
        elsif is_integer?(raw_value)
          raw_value.to_i
        elsif !is_hexadecimal_literal?(raw_value)
          Kernel.Float(raw_value).to_d
        end
      end
Register or log in to add new notes.