Class: ItsyBtc::Commands::DeleteCommand
- Defined in:
- lib/itsy-btc/commands/delete_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#initialize(address) ⇒ DeleteCommand
constructor
A new instance of DeleteCommand.
- #run ⇒ Object
Methods inherited from Command
Constructor Details
#initialize(address) ⇒ DeleteCommand
Returns a new instance of DeleteCommand.
8 9 10 |
# File 'lib/itsy-btc/commands/delete_command.rb', line 8 def initialize(address) @address = address.to_s end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/itsy-btc/commands/delete_command.rb', line 12 def run if @wallet.nil? puts "No wallet found. Run `itsy init` to create one." exit end key = @wallet.key_for_address(@address) if @wallet.remove(@address) puts "Address #{@address} deleted." puts "Here is the key in case you made a mistake: #{key}" else puts "There is no address #{@address} in your wallet." end end |