Sha256: 4b527dad8c0581db2ff44b05ae4ee89ba3c7a606725f3c29787be117b5614229
Contents?: true
Size: 696 Bytes
Versions: 1
Compression:
Stored size: 696 Bytes
Contents
class BitcoinCash def initialize(value, unit = nil) @value = value @unit = unit @satoshi = convert_to_satoshi if @unit end def convert_to_satoshi case @unit when :bch @value * 100000000 when :bit @value * 100 when :sat @value else @value end end def to_bit @satoshi / 100.0 end def to_bch @satoshi / 100000000.0 end alias to_coin to_bch def to_satoshi @satoshi end alias to_smallest to_satoshi def smallest_to_coin @unit ||= :sat @satoshi = @value to_coin end def coin_to_smallest @unit ||= :bch @satoshi = convert_to_satoshi to_smallest end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
currency_units-0.1.6 | lib/currency_units/currencies/bitcoin_cash.rb |