Class: Clandestine::Commands::Get
- Inherits:
-
Object
- Object
- Clandestine::Commands::Get
- Defined in:
- lib/clandestine/commands/get.rb
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(safe_password, key) ⇒ Get
constructor
A new instance of Get.
Constructor Details
#initialize(safe_password, key) ⇒ Get
Returns a new instance of Get.
11 12 13 14 |
# File 'lib/clandestine/commands/get.rb', line 11 def initialize(safe_password, key) @safe_password = safe_password @key = key.to_sym if key end |
Instance Method Details
#get ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/clandestine/commands/get.rb', line 16 def get Safe.new(safe_password).open do |safe| if no_key_or_value?(safe) safe.contents else safe[key] end end end |