Class: Swarm::TraceParticipant

Inherits:
Participant show all
Defined in:
lib/swarm/participants/trace_participant.rb

Instance Attribute Summary

Attributes inherited from Participant

#expression, #hive

Instance Method Summary collapse

Methods inherited from Participant

#arguments, #initialize, #workitem

Constructor Details

This class inherits a constructor from Swarm::Participant

Instance Method Details

#append_to_hive_traceObject



23
24
25
# File 'lib/swarm/participants/trace_participant.rb', line 23

def append_to_hive_trace
  hive.trace(text)
end

#append_to_workitem_traceObject



17
18
19
20
21
# File 'lib/swarm/participants/trace_participant.rb', line 17

def append_to_workitem_trace
  traced = workitem["traced"] || []
  traced << text
  expression.workitem = workitem.merge("traced" => traced)
end

#textObject



13
14
15
# File 'lib/swarm/participants/trace_participant.rb', line 13

def text
  @text ||= arguments.fetch("text", nil)
end

#workObject



5
6
7
8
9
10
11
# File 'lib/swarm/participants/trace_participant.rb', line 5

def work
  if text
    append_to_workitem_trace
    append_to_hive_trace
  end
  expression.reply
end