Class: Clandestine::Commands::Delete

Inherits:
Object
  • Object
show all
Defined in:
lib/clandestine/commands/delete.rb

Instance Method Summary collapse

Constructor Details

#initialize(safe_password, key) ⇒ Delete

Returns a new instance of Delete.



9
10
11
12
# File 'lib/clandestine/commands/delete.rb', line 9

def initialize(safe_password, key)
  @safe_password = safe_password
  @key = key.to_sym
end

Instance Method Details

#deleteObject



14
15
16
17
18
19
20
21
22
# File 'lib/clandestine/commands/delete.rb', line 14

def delete
  Safe.new(safe_password).open do |safe|
    if safe.exists?(key)
      safe.delete(key)
    else
      false
    end
  end
end