Sha256: b69888d6ba5d42c41efc060a6d0a4cc97c2141682b8b0d23f056ebd1ed8395c9

Contents?: true

Size: 359 Bytes

Versions: 1

Compression:

Stored size: 359 Bytes

Contents

# frozen_string_literal: true

require 'flt'
require 'rubygems'
include Flt

DecNum.context.define_conversion_from(BigDecimal) do |x, _context|
  DecNum(x.to_s)
end

DecNum.context.define_conversion_to(BigDecimal) do |x|
  BigDecimal(x.to_s)
end

class Numeric
  def to_dec
    if instance_of?(DecNum)
      self
    else
      DecNum(to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
finrb-0.1.1 lib/finrb/decimal.rb