Class Coercible::Coercer
In: lib/coercible/coercer.rb
lib/coercible/coercer/time_coercions.rb
lib/coercible/coercer/object.rb
lib/coercible/coercer/integer.rb
lib/coercible/coercer/date.rb
lib/coercible/coercer/string.rb
lib/coercible/coercer/decimal.rb
lib/coercible/coercer/hash.rb
lib/coercible/coercer/time.rb
lib/coercible/coercer/numeric.rb
lib/coercible/coercer/date_time.rb
lib/coercible/coercer/float.rb
lib/coercible/coercer/symbol.rb
lib/coercible/coercer/true_class.rb
lib/coercible/coercer/configurable.rb
lib/coercible/coercer/false_class.rb
lib/coercible/coercer/array.rb
Parent: Object

Coercer object

@example

  coercer = Coercible::Coercer.new

  coercer[String].to_boolean('yes') # => true
  coercer[Integer].to_string(1)     # => '1'

@api public

Methods

[]   new   new  

Classes and Modules

Module Coercible::Coercer::Configurable
Module Coercible::Coercer::TimeCoercions
Class Coercible::Coercer::Array
Class Coercible::Coercer::Date
Class Coercible::Coercer::DateTime
Class Coercible::Coercer::Decimal
Class Coercible::Coercer::FalseClass
Class Coercible::Coercer::Float
Class Coercible::Coercer::Hash
Class Coercible::Coercer::Integer
Class Coercible::Coercer::Numeric
Class Coercible::Coercer::Object
Class Coercible::Coercer::String
Class Coercible::Coercer::Symbol
Class Coercible::Coercer::Time
Class Coercible::Coercer::TrueClass

Attributes

coercers  [R]  Return coercer instances

@return [Array<Coercer::Object>]

@api private

config  [R]  Returns global configuration for coercers

@return [Configuration]

@api private

Public Class methods

Initialize a new coercer instance

@param [Hash] coercers

@param [Configuration] config

@return [undefined]

@api private

Build a new coercer

@example

  Coercible::Coercer.new { |config| # set configuration }

@yieldparam [Configuration]

@return [Coercer]

@api public

Public Instance methods

Access a specific coercer object for the given type

@example

  coercer[String] # => string coercer
  coercer[Integer] # => integer coercer

@param [Class] type

@return [Coercer::Object]

@api public

[Validate]