Sha256: 94924a84fb14dff69720eab72c77beeee200da8a0a6bdab6a7114f2b81342e47

Contents?: true

Size: 357 Bytes

Versions: 1

Compression:

Stored size: 357 Bytes

Contents

# frozen_string_literal: true

require "rubygems"
require "flt"
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_d
    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.0 lib/finrb/decimal.rb