Class: Coinbase::BalanceMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/coinbase/balance_map.rb

Overview

A convenience class for printing out crypto asset balances in a human-readable format.

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ BalanceMap

Returns a new BalanceMap object.

Parameters:

  • hash (Map<Symbol, BigDecimal>) (defaults to: {})

    The hash to initialize with



10
11
12
13
14
15
# File 'lib/coinbase/balance_map.rb', line 10

def initialize(hash = {})
  super()
  hash.each do |key, value|
    self[key] = value
  end
end

Instance Method Details

#inspectString

Returns a string representation of the balance map.

Returns:

  • (String)

    The string representation of the balance



25
26
27
# File 'lib/coinbase/balance_map.rb', line 25

def inspect
  to_string
end

#to_sString

Returns a string representation of the balance map.

Returns:

  • (String)

    The string representation of the balance



19
20
21
# File 'lib/coinbase/balance_map.rb', line 19

def to_s
  to_string
end