Sha256: 70867b5f2d73bcdec336e84f6da576e1b7583eb0c5fdbfd995dca6c9d4b6c26c

Contents?: true

Size: 741 Bytes

Versions: 18

Compression:

Stored size: 741 Bytes

Contents

module Virtus
  class Attribute

    # Date
    #
    # @example
    #   class Post
    #     include Virtus
    #
    #     attribute :published_on, Date
    #   end
    #
    #   Post.new(:published_on => Date.today)
    #
    #   # typecasting from a string
    #   Post.new(:published_on => '2011/06/09')
    #
    #   # typecasting from a hash
    #   Post.new(:published_on => {
    #     :year  => 2011,
    #     :month => 6,
    #     :day   => 9,
    #   })
    #
    #   # typecasting from an object which implements #to_date
    #   Post.new(:published_on => DateTime.now)
    #
    class Date < Object
      primitive       ::Date
      coercion_method :to_date

    end # class Date
  end # class Attribute
end # module Virtus

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
virtus-0.5.5 lib/virtus/attribute/date.rb
virtus-0.5.4 lib/virtus/attribute/date.rb
virtus-0.5.3 lib/virtus/attribute/date.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/lib/virtus/attribute/date.rb
virtus-0.5.2 lib/virtus/attribute/date.rb
virtus-0.5.1 lib/virtus/attribute/date.rb
virtus-0.5.0 lib/virtus/attribute/date.rb
virtus-0.4.2 lib/virtus/attribute/date.rb
virtus-0.4.1 lib/virtus/attribute/date.rb
virtus-0.4.0 lib/virtus/attribute/date.rb
virtus-0.3.0 lib/virtus/attribute/date.rb
virtus-0.2.0 lib/virtus/attribute/date.rb
virtus-0.1.0 lib/virtus/attribute/date.rb
virtus-0.0.10 lib/virtus/attribute/date.rb
virtus-0.0.9 lib/virtus/attribute/date.rb
virtus-0.0.8 lib/virtus/attribute/date.rb
virtus-0.0.7 lib/virtus/attribute/date.rb
virtus-0.0.6 lib/virtus/attribute/date.rb