Class: Zold::List
- Inherits:
-
Object
- Object
- Zold::List
- Includes:
- ThreadBadge
- Defined in:
- lib/zold/commands/list.rb
Overview
LIST command
Instance Method Summary collapse
-
#initialize(wallets:, copies:, log: Log::NULL) ⇒ List
constructor
A new instance of List.
- #run(_ = []) ⇒ Object
Constructor Details
Instance Method Details
#run(_ = []) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/zold/commands/list.rb', line 44 def run(_ = []) total = 0 txns = 0 size = 0 balance = Amount::ZERO @wallets.all.sort.each do |id| total += 1 cps = Copies.new(File.join(@copies, id)) @wallets.acq(id) do |wallet| msg = "#{wallet.mnemo} #{cps.all.count}c" msg += " (net:#{wallet.network})" if wallet.network != Wallet::MAINET txns += wallet.txns.count balance += wallet.balance size += wallet.size @log.info(msg) end end @log.info("#{total} wallets, #{txns} transactions, #{Size.new(size)}, #{balance} in total") end |