Class: Taskchampion::WorkingSet

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

Overview

Override WorkingSet to add task lookup functionality

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#replicaObject

Store replica reference for task lookup



14
15
16
# File 'lib/taskchampion.rb', line 14

def replica
  @replica
end

Instance Method Details

#_original_by_indexObject



16
# File 'lib/taskchampion.rb', line 16

alias_method :_original_by_index, :by_index

#by_index(index) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/taskchampion.rb', line 18

def by_index(index)
  uuid_string = _original_by_index(index)
  return nil if uuid_string.nil? || uuid_string.to_s.empty?

  # If we have a replica reference, look up the actual task
  if @replica
    @replica.task(uuid_string)
  else
    uuid_string
  end
end