Class: Benelux::Track

Inherits:
Object show all
Defined in:
lib/benelux/track.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(n, g = nil) ⇒ Track

Returns a new instance of Track.



8
9
10
11
# File 'lib/benelux/track.rb', line 8

def initialize(n,g=nil)
  @name, @thgrp = n, (g || ThreadGroup.new)
  @timeline = Benelux::Timeline.new
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/benelux/track.rb', line 5

def name
  @name
end

#thread_groupObject (readonly)

Returns the value of attribute thread_group.



6
7
8
# File 'lib/benelux/track.rb', line 6

def thread_group
  @thread_group
end

#timelineObject (readonly)

Returns the value of attribute timeline.



7
8
9
# File 'lib/benelux/track.rb', line 7

def timeline
  @timeline
end

Instance Method Details

#add_thread(t = Thread.current) ⇒ Object



12
13
14
15
# File 'lib/benelux/track.rb', line 12

def add_thread(t=Thread.current)
  @thgrp.add t
  t
end

#threadsObject



16
17
18
# File 'lib/benelux/track.rb', line 16

def threads
  @thgrp.list
end