Class: Tap::Test::TapTest::Tracer

Inherits:
Object
  • Object
show all
Includes:
Support::Executable
Defined in:
lib/tap/test/tap_test.rb

Instance Attribute Summary

Attributes included from Support::Executable

#_method_name, #app, #batch, #dependencies, #on_complete_block

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Executable

#_execute, #batch_index, #batch_with, #batched?, #check_terminate, #depends_on, #enq, #execute, #fork, initialize, #initialize_batch_obj, #inspect, #merge, #on_complete, #reset_dependencies, #resolve_dependencies, #sequence, #switch, #sync_merge, #unbatched_depends_on, #unbatched_enq, #unbatched_on_complete

Constructor Details

#initialize(index, app, runlist) ⇒ Tracer

Returns a new instance of Tracer.



74
75
76
77
78
79
80
81
82
83
# File 'lib/tap/test/tap_test.rb', line 74

def initialize(index, app, runlist)
  @index = index
  @runlist = runlist

  @app = app
  @_method_name = :trace
  @on_complete_block =nil
  @dependencies = []
  @batch = [self]
end

Class Method Details

.intern(n, app, runlist) ⇒ Object



69
70
71
# File 'lib/tap/test/tap_test.rb', line 69

def intern(n, app, runlist)
  Array.new(n) { |index| new(index, app, runlist) }
end

Instance Method Details

#concat(str, id) ⇒ Object



85
86
87
# File 'lib/tap/test/tap_test.rb', line 85

def concat(str, id)
  "#{str} #{id}".strip
end

#trace(trace) ⇒ Object



89
90
91
92
93
94
95
96
97
98
# File 'lib/tap/test/tap_test.rb', line 89

def trace(trace)
  id = "#{@index}.#{batch_index}"
  @runlist << id

  case trace
  when Array then trace.collect {|str| concat(str, id) }
  when String then concat(trace, id)
  else raise "cannot utilize trace: #{trace}"
  end
end