22
23
24
25
26
27
28
29
30
|
# File 'lib/croesus/coercions/fixnum_definitions.rb', line 22
def self.bind_to(coercer)
coercer.register(Fixnum, String) { |obj, _| obj.to_s }
coercer.register(Fixnum, Time) { |obj, _| Time.at(obj) }
coercer.register(Fixnum, Date) { |obj, _| Time.at(obj).to_date }
coercer.register(Fixnum, DateTime) { |obj, _| Time.at(obj).to_datetime }
coercer.register(Fixnum, String) { |obj, _| obj.to_s }
coercer.register(Fixnum, Integer) { |obj, _| obj.to_i }
coercer.register(Fixnum, Float) { |obj, _| obj.to_f }
end
|