Class: Cardigan::Command::ChangeStatus
- Inherits:
-
Object
- Object
- Cardigan::Command::ChangeStatus
- Defined in:
- lib/cardigan/command/change_status.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
- #completion(text) ⇒ Object
- #execute(status) ⇒ Object
-
#initialize(entry, workflow_repository) ⇒ ChangeStatus
constructor
A new instance of ChangeStatus.
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
#help ⇒ Object (readonly)
Returns the value of attribute help.
4 5 6 |
# File 'lib/cardigan/command/change_status.rb', line 4 def help @help end |
#usage ⇒ Object (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 |