Class: Cardigan::Command::ChangeValue

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, io) ⇒ ChangeValue

Returns a new instance of ChangeValue.



7
8
9
10
11
# File 'lib/cardigan/command/change_value.rb', line 7

def initialize entry, io
  @entry, @io = entry, io
  @usage = '<key>'
  @help = 'Prompt for a new value to associate with the specified key'
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



5
6
7
# File 'lib/cardigan/command/change_value.rb', line 5

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



5
6
7
# File 'lib/cardigan/command/change_value.rb', line 5

def usage
  @usage
end

Instance Method Details

#execute(key) ⇒ Object



13
14
15
# File 'lib/cardigan/command/change_value.rb', line 13

def execute key
  Cardigan::CardEditor.new(@entry, @io).set key, @io.ask("Enter the new value for #{key}")
end