Sha256: daeec3bae8b0392b8def93a43f97695e0e48935d55fef01dbd875e9931236642

Contents?: true

Size: 324 Bytes

Versions: 2

Compression:

Stored size: 324 Bytes

Contents

module Arstotzka
  module TypeCast
    def to_period(value)
      Mercy::PeriodParser.parse(value)
    end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercy-1.6.0 lib/arstotzka/type_cast_ext.rb
mercy-1.5.0 lib/arstotzka/type_cast_ext.rb