module TaskwarriorWeb::CommandBuilder::V1

Public Instance Methods

assign_id_from_uuid() click to toggle source
# 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() click to toggle source
# 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() click to toggle source

Overridden from TaskwarriorWeb::CommandBuilder::Base

Substitute the task's ID for its UUID.

# 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