Class: Cardigan::Command::ChangeStatus

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, workflow_repository) ⇒ ChangeStatus

Returns a new instance of ChangeStatus.



6
7
8
9
10
# File 'lib/cardigan/command/change_status.rb', line 6

def initialize entry, workflow_repository
  @entry, @workflow_repository = entry, workflow_repository
  @usage = '<new status>'
  @help = 'Changes the status of the current entry'
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



4
5
6
# File 'lib/cardigan/command/change_status.rb', line 4

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



4
5
6
# File 'lib/cardigan/command/change_status.rb', line 4

def usage
  @usage
end

Instance Method Details

#completion(text) ⇒ Object



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

def completion text
  status = @entry['status'] || 'none'
  @workflow_repository.load[status].grep(/^#{text}/).sort || []
end

#execute(status) ⇒ Object



17
18
19
# File 'lib/cardigan/command/change_status.rb', line 17

def execute status
  @entry['status'] = status
end