Class: Zold::Create

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

Overview

Create command

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Create.



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

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

Instance Method Details

#run(args = []) ⇒ Object



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

def run(args = [])
  id = args.empty? ? Id.new : Id.new(args[0])
  wallet = @wallets.find(id)
  wallet.init(id, @pubkey)
  @log.info(wallet.id)
  @log.debug("Wallet #{Rainbow(wallet).green} \
created at #{@wallets.path}")
  wallet
end