Class: ThreadStack

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

Defined Under Namespace

Classes: Call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack) ⇒ ThreadStack

Returns a new instance of ThreadStack.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/threadStack.rb', line 41

def initialize(stack)
	previousCall = nil
	stack.each { |text|
		call = Call.new(text.chomp)
		if not previousCall.nil?
			call.children << previousCall
		end
		previousCall = call
	}
	@call = previousCall
end

Instance Attribute Details

#callObject (readonly)

Returns the value of attribute call.



39
40
41
# File 'lib/threadStack.rb', line 39

def call
  @call
end

Instance Method Details

#children_sortedObject



57
58
59
# File 'lib/threadStack.rb', line 57

def children_sorted
	call.children_sorted
end

#countObject



61
62
63
# File 'lib/threadStack.rb', line 61

def count
	call.count
end

#merge(threadStack) ⇒ Object



53
54
55
# File 'lib/threadStack.rb', line 53

def merge(threadStack)
	@call.merge(threadStack.call)
end

#text_countObject



65
66
67
# File 'lib/threadStack.rb', line 65

def text_count
	call.text_count
end