Class: Cue::Command::Toggle

Inherits:
Base
  • Object
show all
Defined in:
lib/cue/command/toggle.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#find_item, #find_key, #parser

Constructor Details

#initialize(args) ⇒ Toggle

Returns a new instance of Toggle.



6
7
8
9
# File 'lib/cue/command/toggle.rb', line 6

def initialize(args)
  super(args)
  @sha = @args.first
end

Instance Method Details

#executeObject



11
12
13
14
15
16
# File 'lib/cue/command/toggle.rb', line 11

def execute
  find_item(@sha).tap do |item|
    item.toggle!
    item.save(options.store)
  end
end

#nargsObject



18
19
20
# File 'lib/cue/command/toggle.rb', line 18

def nargs
  1
end