class Stellar::Amount
Attributes
amount[R]
currency[R]
Public Class Methods
new(amount, currency=Stellar::Currency.native())
click to toggle source
# File lib/stellar/amount.rb, line 9 def initialize(amount, currency=Stellar::Currency.native()) # TODO: how are we going to handle decimal considerations? @amount = amount @currency = currency end
Public Instance Methods
inspect()
click to toggle source
# File lib/stellar/amount.rb, line 33 def inspect "#<Stellar::Amount #{currency}(#{amount})>" end
to_payment()
click to toggle source
# File lib/stellar/amount.rb, line 21 def to_payment case currency.type when CurrencyType.native [:native, amount] when CurrencyType.iso4217 keypair = KeyPair.from_public_key(currency.issuer) [:iso4217, currency, keypair, amount] else raise "Unknown currency type: #{currency.type}" end end