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.


31
32
33
34
# File 'lib/zold/commands/list.rb', line 31

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

Instance Method Details

#run(_ = []) ⇒ Object


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

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