Class: Cardigan::Command::EditValue
- Inherits:
-
Object
- Object
- Cardigan::Command::EditValue
- Defined in:
- lib/cardigan/command/edit_value.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute(key) ⇒ Object
-
#initialize(entry, io) ⇒ EditValue
constructor
A new instance of EditValue.
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
#help ⇒ Object (readonly)
Returns the value of attribute help.
6 7 8 |
# File 'lib/cardigan/command/edit_value.rb', line 6 def help @help end |
#usage ⇒ Object (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 |