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