Class: Virtus::Coercion Abstract

Inherits:
Object
  • Object
show all
Extended by:
DescendantsTracker, Options, TypeLookup
Defined in:
lib/virtus/coercion.rb,
lib/virtus/coercion/date.rb,
lib/virtus/coercion/hash.rb,
lib/virtus/coercion/time.rb,
lib/virtus/coercion/array.rb,
lib/virtus/coercion/float.rb,
lib/virtus/coercion/object.rb,
lib/virtus/coercion/string.rb,
lib/virtus/coercion/symbol.rb,
lib/virtus/coercion/decimal.rb,
lib/virtus/coercion/integer.rb,
lib/virtus/coercion/numeric.rb,
lib/virtus/coercion/date_time.rb,
lib/virtus/coercion/true_class.rb,
lib/virtus/coercion/false_class.rb,
lib/virtus/coercion/time_coercions.rb

Overview

This class is abstract.

Coerce abstract class

Direct Known Subclasses

Object

Defined Under Namespace

Modules: TimeCoercions Classes: Array, Date, DateTime, Decimal, FalseClass, Float, Hash, Integer, Numeric, Object, String, Symbol, Time, TrueClass

Constant Summary

Constants included from TypeLookup

TypeLookup::TYPE_FORMAT

Class Method Summary collapse

Methods included from TypeLookup

determine_type, extended, primitive

Methods included from Options

accept_options, accepted_options, options

Class Method Details

.[](name) ⇒ Class

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a class that matches given name

Defaults to Virtus::Coercion::Object

Examples:

Virtus::Coercion['String'] # => Virtus::Coercion::String
Virtus::Coercion[String]   # => Virtus::Coercion::String

Parameters:

Returns:

  • (Class)


27
28
29
# File 'lib/virtus/coercion.rb', line 27

def self.[](name)
  determine_type(name) or Coercion::Object
end