Class: Cardigan::Command::EditValue

Inherits:
Object
  • Object
show all
Defined in:
lib/cardigan/command/edit_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, io) ⇒ EditValue

Returns a new instance of EditValue.



8
9
10
11
12
# File 'lib/cardigan/command/edit_value.rb', line 8

def initialize entry, io
  @entry, @io = entry, io
  @usage = '<key>'
  @help = 'Launch default editor to specify a new value to associate with the specified key'
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



6
7
8
# File 'lib/cardigan/command/edit_value.rb', line 6

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



6
7
8
# File 'lib/cardigan/command/edit_value.rb', line 6

def usage
  @usage
end

Instance Method Details

#execute(key) ⇒ Object



14
15
16
17
# File 'lib/cardigan/command/edit_value.rb', line 14

def execute key
  value = @entry[key] ? @entry[key] : ''
  Cardigan::CardEditor.new(@entry, @io).set key, value.to_editor
end