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



25
26
27
# File 'lib/swarm/participants/trace_participant.rb', line 25

def append_to_hive_trace
  hive.trace(text)
end

#append_to_workitem_traceObject



19
20
21
22
23
# File 'lib/swarm/participants/trace_participant.rb', line 19

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

#textObject



15
16
17
# File 'lib/swarm/participants/trace_participant.rb', line 15

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

#workObject



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

def work
  if text
    append_to_workitem_trace
    append_to_hive_trace
  end
  expression.reply
end