Class: ThreadStack
- Inherits:
-
Object
- Object
- ThreadStack
- Defined in:
- lib/threadStack.rb
Defined Under Namespace
Classes: Call
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
Instance Method Summary collapse
- #children_sorted ⇒ Object
- #count ⇒ Object
-
#initialize(stack) ⇒ ThreadStack
constructor
A new instance of ThreadStack.
- #merge(threadStack) ⇒ Object
- #text_count ⇒ Object
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
#call ⇒ Object (readonly)
Returns the value of attribute call.
39 40 41 |
# File 'lib/threadStack.rb', line 39 def call @call end |
Instance Method Details
#children_sorted ⇒ Object
57 58 59 |
# File 'lib/threadStack.rb', line 57 def children_sorted call.children_sorted end |
#count ⇒ Object
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_count ⇒ Object
65 66 67 |
# File 'lib/threadStack.rb', line 65 def text_count call.text_count end |