Sha256: 88d5b32e492c6a1858f335c3f0586895653e850763a30658bf050c8c55b8c8ed

Contents?: true

Size: 615 Bytes

Versions: 9

Compression:

Stored size: 615 Bytes

Contents

module Virtus

  # Coerce abstract class
  #
  # @abstract
  #
  class Coercion
    extend DescendantsTracker
    extend TypeLookup
    extend Options

    accept_options :primitive

    # Return a class that matches given name
    #
    # Defaults to Virtus::Coercion::Object
    #
    # @example
    #   Virtus::Coercion['String'] # => Virtus::Coercion::String
    #   Virtus::Coercion[String]   # => Virtus::Coercion::String
    #
    # @param [String]
    #
    # @return [Class]
    #
    # @api private
    def self.[](name)
      determine_type(name) || Coercion::Object
    end

  end # Coerce
end # Virtus

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
virtus-0.4.0 lib/virtus/coercion.rb
virtus-0.3.0 lib/virtus/coercion.rb
virtus-0.2.0 lib/virtus/coercion.rb
virtus-0.1.0 lib/virtus/coercion.rb
virtus-0.0.10 lib/virtus/coercion.rb
virtus-0.0.9 lib/virtus/coercion.rb
virtus-0.0.8 lib/virtus/coercion.rb
virtus-0.0.7 lib/virtus/coercion.rb
virtus-0.0.6 lib/virtus/coercion.rb