Class: Croesus::Coercions::TimeDefinitions
- Defined in:
- lib/croesus/coercions/time_definitions.rb
Class Method Summary collapse
Class Method Details
.bind_to(coercer) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/croesus/coercions/time_definitions.rb', line 22 def self.bind_to(coercer) coercer.register(Time, Date) { |obj, _| obj.to_date } coercer.register(Time, DateTime) { |obj, _| obj.to_datetime } coercer.register(Time, Integer) { |obj, _| obj.to_i } coercer.register(Time, Float) { |obj, _| obj.to_f } coercer.register(Time, String) { |obj, _| obj.to_s } end |