Module: Arstotzka::TypeCast
- Defined in:
- lib/arstotzka/type_cast_ext.rb
Instance Method Summary collapse
Instance Method Details
#to_infinity_float(value) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/arstotzka/type_cast_ext.rb', line 7 def to_infinity_float(value) return value if value.is_a?(Numeric) return -Float::INFINITY if value.match(/-inf/) return Float::INFINITY if value.match(/inf/) value.to_f end |
#to_period(value) ⇒ Object
3 4 5 |
# File 'lib/arstotzka/type_cast_ext.rb', line 3 def to_period(value) Mercy::PeriodParser.parse(value) end |