Class: Stellar::Currency
- Inherits:
-
XDR::Union
- Object
- XDR::Union
- Stellar::Currency
- Defined in:
- lib/stellar/currency.rb,
generated/stellar/currency.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.iso4217(code, issuer) ⇒ Object
7 8 9 10 11 |
# File 'lib/stellar/currency.rb', line 7 def self.iso4217(code, issuer) raise ArgumentError, "Bad :issuer" unless issuer.is_a?(KeyPair) ici = ISOCurrencyIssuer.new({currency_code:code, issuer:issuer.public_key}) new(:iso4217, ici) end |
.native ⇒ Object
3 4 5 |
# File 'lib/stellar/currency.rb', line 3 def self.native new(:native) end |
Instance Method Details
#code ⇒ Object
28 29 30 |
# File 'lib/stellar/currency.rb', line 28 def code self.iso_ci!.currency_code end |
#inspect ⇒ Object
23 24 25 26 |
# File 'lib/stellar/currency.rb', line 23 def inspect label = switch.to_s "#<Stellar::Currency #{to_s}>" end |
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/stellar/currency.rb', line 13 def to_s if switch == CurrencyType.native "native" else encoder = Stellar::Util::Base58.stellar issuer_address = encoder.check_encode(:account_id,iso_ci.issuer) "#{iso_ci.currency_code}/#{issuer_address}" end end |