Sha256: 679ff13fff04161b5978692132f3b7971ae3437a52cc78afa231a44611b56eae

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

module Virtus
  class Attribute

    # Example usage
    #
    #   class User
    #     include Virtus
    #
    #     attribute :name, String
    #   end
    #
    #   User.new(:name => 'John')
    #
    #   # typecasting from an object which implements #to_s
    #   User.new(:name => :John)
    #
    class String < Object
      primitive ::String

      # @see Virtus::Typecast::String.call
      #
      # @return [String]
      #
      # @api private
      def typecast_to_primitive(value)
        Virtus::Typecast::String.call(value)
      end

    end # class String
  end # class Attribute
end # module Virtus

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virtus-0.0.5 lib/virtus/attribute/string.rb