Class Coercible::Coercer::Integer
In: lib/coercible/coercer/integer.rb
Parent: Numeric

Coerce Fixnum values

Methods

Attributes

boolean_map  [R]  Return boolean map from config

@return [::Hash]

@api private

datetime_format  [R]  Return datetime format from config

@return [::String]

@api private

datetime_proc  [R]  Return datetime proc from config

@return [Proc]

@api private

Public Class methods

Return default config for Integer coercer type

@return [Configuration]

@see Configurable#config

@api private

Initialize a new Integer coercer instance and set its configuration

@return [undefined]

@api private

Public Instance methods

Coerce given value to a Boolean

@example with a 1

  coercer[Integer].to_boolean(1)  # => true

@example with a 0

  coercer[Integer].to_boolean(0)  # => false

@param [Fixnum] value

@return [BigDecimal]

@api public

Coerce given value to a DateTime

@example

  coercer[Integer].to_datetime(0)  # => Thu, 01 Jan 1970 00:00:00 +0000

@param [Integer] value

@return [DateTime]

@api public

Passthrough the value

@example

  coercer[Integer].to_integer(1)  # => 1

@param [Fixnum] value

@return [Float]

@api public

Coerce given value to String

@example

  coercer[Integer].to_string(1)  # => "1"

@param [Fixnum] value

@return [String]

@api public

[Validate]