method

cast

cast(value)
public

No documentation available.

# File activemodel/lib/active_model/type/helpers/numeric.rb, line 15
        def cast(value)
          # Checks whether the value is numeric. Spaceship operator
          # will return nil if value is not numeric.
          value = if value <=> 0
            value
          else
            case value
            when true then 1
            when false then 0
            else value.presence
            end
          end

          super(value)
        end