Module: TaskwarriorWeb::CommandBuilder::V1
- Includes:
- Base
- Defined in:
- lib/taskwarrior-web/services/builder/v1.rb
Constant Summary
Constants included from Base
Instance Method Summary collapse
- #assign_id_from_uuid ⇒ Object
- #build ⇒ Object
-
#substitute_parts ⇒ Object
Overridden from TaskwarriorWeb::CommandBuilder::Base.
Methods included from Base
Instance Method Details
#assign_id_from_uuid ⇒ Object
26 27 28 29 |
# File 'lib/taskwarrior-web/services/builder/v1.rb', line 26 def assign_id_from_uuid @all_tasks ||= TaskwarriorWeb::Task.query('status.not' => [:deleted, :completed]) @id = @all_tasks.index { |task| task.uuid == @id } + 1 end |
#build ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/taskwarrior-web/services/builder/v1.rb', line 5 def build unless @command_string task_command substitute_parts if @command_string =~ /:id/ end parse_params @built = "#{self.command_string}#{params}" end |
#substitute_parts ⇒ Object
Overridden from TaskwarriorWeb::CommandBuilder::Base
Substitute the task’s ID for its UUID.
17 18 19 20 21 22 23 24 |
# File 'lib/taskwarrior-web/services/builder/v1.rb', line 17 def substitute_parts if @id assign_id_from_uuid @command_string.gsub!(':id', @id.to_s) return self end raise TaskwarriorWeb::CommandBuilder::MissingTaskIDError end |