class Garcon::Coercions::DateDefinitions

Public Class Methods

bind_to(coercer) click to toggle source
# File lib/garcon/chef/coerce/coercions/date_definitions.rb, line 23
def self.bind_to(coercer)
  coercer.register(Date, Time)     { |obj, _| obj.to_time }
  coercer.register(Date, DateTime) { |obj, _| obj.to_datetime }
  coercer.register(Date, Integer)  { |obj, _| obj.to_time.to_i }
  coercer.register(Date, Float)    { |obj, _| obj.to_time.to_f }
  coercer.register(Date, String)   { |obj, _| obj.to_s }
end