Methods

Included Modules

Class Index [+]

Quicksearch

DataMapper::Property::Typecast::Time

Public Instance Methods

extract_time(value) click to toggle source

Extracts the given args from the hash. If a value does not exist, it uses the value of Time.now.

@param [Hash, #] value

  value to extract time args from

@return [Array]

  Extracted values

@api private

    # File lib/dm-core/property/typecast/time.rb, line 17
17:         def extract_time(value)
18:           mash = if value.respond_to?(:to_mash)
19:                    value.to_mash
20:                  else
21:                    DataMapper::Ext::Hash.to_mash(value)
22:                  end
23: 
24:           now  = ::Time.now
25: 
26:           [ :year, :month, :day, :hour, :min, :sec ].map do |segment|
27:             typecast_to_numeric(mash.fetch(segment, now.send(segment)), :to_i)
28:           end
29:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.