Sha256: 069e3bcceea13160c23d171a83c4ade34ed14af20537f525d1c8a2e166a3b845

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

Contents

module Virtus
  class Coercion

    # Coerce Time values
    class Time < Object
      extend TimeCoercions

      primitive ::Time

      # Passthrough the value
      #
      # @example
      #   Virtus::Coercion::DateTime.to_time(time)  # => Time object
      #
      # @param [DateTime] value
      #
      # @return [Date]
      #
      # @api public
      def self.to_time(value)
        value
      end

      # Creates a Fixnum instance from a Time object
      #
      # @example
      #   Virtus::Coercion::Time.to_integer(time)  # => Fixnum object
      #
      # @param [Time] value
      #
      # @return [Fixnum]
      #
      # @api public
      def self.to_integer(value)
        value.to_i
      end

    end # class Time
  end # class Coercion
end # module Virtus

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
virtus-0.5.5 lib/virtus/coercion/time.rb
virtus-0.5.4 lib/virtus/coercion/time.rb
virtus-0.5.3 lib/virtus/coercion/time.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/lib/virtus/coercion/time.rb
virtus-0.5.2 lib/virtus/coercion/time.rb
virtus-0.5.1 lib/virtus/coercion/time.rb
virtus-0.5.0 lib/virtus/coercion/time.rb
virtus-0.4.2 lib/virtus/coercion/time.rb
virtus-0.4.1 lib/virtus/coercion/time.rb
virtus-0.4.0 lib/virtus/coercion/time.rb
virtus-0.3.0 lib/virtus/coercion/time.rb
virtus-0.2.0 lib/virtus/coercion/time.rb