Included Modules

Class Index [+]

Quicksearch

DataMapper::Property::Time

Public Instance Methods

typecast_hash_to_time(value) click to toggle source

Creates a Time instance from a Hash with keys :year, :month, :day, :hour, :min, :sec

@param [Hash, #] value

  value to be typecast

@return [Time]

  Time constructed from hash

@api private

    # File lib/dm-core/property/time.rb, line 41
41:       def typecast_hash_to_time(value)
42:         ::Time.local(*extract_time(value))
43:       end
typecast_to_primitive(value) click to toggle source

Typecasts an arbitrary value to a Time Handles both Hashes and Time instances.

@param [Hash, #, #] value

  value to be typecast

@return [Time]

  Time constructed from value

@api private

    # File lib/dm-core/property/time.rb, line 19
19:       def typecast_to_primitive(value)
20:         if value.respond_to?(:to_time)
21:           value.to_time
22:         elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)
23:           typecast_hash_to_time(value)
24:         else
25:           ::Time.parse(value.to_s)
26:         end
27:       rescue ArgumentError
28:         value
29:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.