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