Sha256: 44c393ce7a4d9a9829aa370673da91eac3a8d29514c6cfff54ad854a2f5be50c
Contents?: true
Size: 591 Bytes
Versions: 1
Compression:
Stored size: 591 Bytes
Contents
# Ripple class Ripple def initialize(value, unit = nil) @value = value @unit = unit @drop = convert_to_drop if @unit end def convert_to_drop case @unit when :xrp @value * 1_000_000 when :drop @value else @value end end def to_xrp @drop / 1_000_000.0 end alias to_coin to_xrp def to_drop @drop end def to_smallest to_drop end def smallest_to_coin @unit ||= :drop @drop = @value to_coin end def coin_to_smallest @unit ||= :xrp @drop = convert_to_drop 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/ripple.rb |