Class: TaskWarrior::Dependencies::TaskPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/twdeps/task_presenter.rb

Overview

Presents a task’s attributes suitable for a GraphViz node

Instance Method Summary collapse

Constructor Details

#initialize(task) ⇒ TaskPresenter

Returns a new instance of TaskPresenter.



7
8
9
# File 'lib/twdeps/task_presenter.rb', line 7

def initialize(task)
  @task = task
end

Instance Method Details

#attributesObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/twdeps/task_presenter.rb', line 11

def attributes
  attrs = {:label => @task.description}
  attrs.merge!({:tooltip => "Status: #{@task.status}"})

  # TODO Once we see the urgency in the JSON export, we can color-code the nodes
  # http://taskwarrior.org/issues/973
  # attrs.merge!({:fillcolor => 'red', :style => 'filled'})

  attrs.merge!({:fontcolor => 'gray', :color => 'gray'}) if :completed == @task.status
  attrs
end

#idObject



23
24
25
# File 'lib/twdeps/task_presenter.rb', line 23

def id
  @task.uuid
end