class ThreadStack::Call

Attributes

children[RW]
count[RW]
text[RW]

Public Class Methods

new(text) click to toggle source
# File lib/threadStack.rb, line 8
def initialize(text)
        @text = text
        @children = Array.new
        @count = 1
end

Public Instance Methods

children_sorted() click to toggle source
# File lib/threadStack.rb, line 34
def children_sorted
  children.compact.sort { |a,b| b.count <=> a.count}
end
merge(call) click to toggle source
# File lib/threadStack.rb, line 14
def merge(call)
        if call.nil?
                false
        elsif @text == call.text
                @count += 1
                @children.compact!
                if @children.count{ |x| x.merge(call.children[0])} == 0
                        @children << call.children[0]
                end
                @children.compact!
                true
        else
                false
        end
end
text_count() click to toggle source
# File lib/threadStack.rb, line 30
def text_count
        "#{text} - (#{count})"
end