Class: Zold::List

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/commands/list.rb

Overview

LIST command

Instance Method Summary collapse

Constructor Details

#initialize(wallets:, log: Log::Quiet.new) ⇒ List

Returns a new instance of List.



33
34
35
36
# File 'lib/zold/commands/list.rb', line 33

def initialize(wallets:, log: Log::Quiet.new)
  @wallets = wallets
  @log = log
end

Instance Method Details

#run(_ = []) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/zold/commands/list.rb', line 38

def run(_ = [])
  @wallets.all.each do |id|
    wallet = Wallet.new(File.join(@wallets.path, id))
    msg = "#{id}: #{wallet.balance}/#{wallet.txns.count}t"
    msg += " (net:#{wallet.network})" if wallet.network != Wallet::MAIN_NETWORK
    @log.info(msg)
  end
end