Class: Cue::Command::Add
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ Add
constructor
A new instance of Add.
- #nargs ⇒ Object
Methods inherited from Base
#find_item, #find_key, #parser
Constructor Details
#initialize(args) ⇒ Add
Returns a new instance of Add.
7 8 9 10 11 12 13 14 15 |
# File 'lib/cue/command/add.rb', line 7 def initialize(args) super(args) if @args.size == 1 @content = @args.first else @content = Utils::Editor.new.read end end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 |
# File 'lib/cue/command/add.rb', line 17 def execute item = Cue::Item.new(@content) item.save(.store) end |
#nargs ⇒ Object
22 23 24 |
# File 'lib/cue/command/add.rb', line 22 def nargs (0..1) end |