Creates a DateTime instance from a Hash with keys :year, :month, :day, :hour, :min, :sec
@param [Hash, #] value
value to be typecast
@return [DateTime]
DateTime constructed from hash
@api private
# File lib/dm-core/property/date_time.rb, line 39 39: def typecast_hash_to_datetime(value) 40: ::DateTime.new(*extract_time(value)) 41: end
Typecasts an arbitrary value to a DateTime. Handles both Hashes and DateTime instances.
@param [Hash, #, #] value
value to be typecast
@return [DateTime]
DateTime constructed from value
@api private
# File lib/dm-core/property/date_time.rb, line 19 19: def typecast_to_primitive(value) 20: if value.is_a?(::Hash) || value.respond_to?(:to_mash) 21: typecast_hash_to_datetime(value) 22: else 23: ::DateTime.parse(value.to_s) 24: end 25: rescue ArgumentError 26: value 27: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.