Class: ThreadStackExtractor
- Inherits:
-
Object
- Object
- ThreadStackExtractor
- Defined in:
- lib/threadStackExtractor.rb
Instance Method Summary collapse
- #getThreadStacks ⇒ Object
-
#initialize(file) ⇒ ThreadStackExtractor
constructor
A new instance of ThreadStackExtractor.
Constructor Details
#initialize(file) ⇒ ThreadStackExtractor
Returns a new instance of ThreadStackExtractor.
3 4 5 |
# File 'lib/threadStackExtractor.rb', line 3 def initialize(file) @file = file end |
Instance Method Details
#getThreadStacks ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/threadStackExtractor.rb', line 7 def getThreadStacks stacks = Array.new() stack = Array.new() while (line = @file.gets) encoded = line.encode('UTF-8', 'UTF-8', { :invalid => :replace }) case encoded when /^3XMTHREADINFO\s*(.*)/ then stacks << stack unless stack.empty? stack = Array.new() when /^4XESTACKTRACE\s*(.*)/ then stack << $1 end end stacks << stack unless stack.empty? return stacks end |