Class: Croesus::Coercions::DateDefinitions
- Defined in:
- lib/croesus/coercions/date_definitions.rb
Class Method Summary collapse
Class Method Details
.bind_to(coercer) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/croesus/coercions/date_definitions.rb', line 22 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 |