Sha256: 3fdc589870f6f80037d93060052c7b3350491330e77200ece4e8e58af0f7c314

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

module CoreExtensions
  module Number
    module Currency
      def to_satoshi
        (self * 1e8).to_i
      end

      def to_token(format: 8)
        (self.to_i / (10**format).to_f).to_d.to_s('F')
      end
    end
  end
end

if RUBY_VERSION.to_f < 2.4
  Fixnum.include CoreExtensions::Number::Currency
  Float.include CoreExtensions::Number::Currency
else
  Integer.include CoreExtensions::Number::Currency
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crypto_formatter-0.2.0 lib/core_extensions/number/currency.rb