Class: UIAutoMonkey::LogDecoder
- Inherits:
-
Object
- Object
- UIAutoMonkey::LogDecoder
- Defined in:
- lib/crash_monkey/monkey_runner.rb
Instance Method Summary collapse
- #decode_latest(num = 10) ⇒ Object
-
#initialize(log_list) ⇒ LogDecoder
constructor
A new instance of LogDecoder.
Constructor Details
#initialize(log_list) ⇒ LogDecoder
Returns a new instance of LogDecoder.
299 300 301 |
# File 'lib/crash_monkey/monkey_runner.rb', line 299 def initialize(log_list) @log_list = log_list end |
Instance Method Details
#decode_latest(num = 10) ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/crash_monkey/monkey_runner.rb', line 303 def decode_latest(num=10) hash = {} ret = [] @log_list.reverse.each do |log| break if num == 0 if log[LOG_TYPE] == 'Screenshot' if log[MESSAGE] =~ /^action/ hash[:action_image] = log[MESSAGE] elsif log[MESSAGE] =~ /^screen/ hash[:screen_image] = log[MESSAGE] hash[:timestamp] = log[TIMESTAMP] # emit and init if block_given? yield(hash) else ret << hash end hash = {} num -= 1 end elsif log[LOG_TYPE] == 'Debug' && log[MESSAGE] =~ /^target./ hash[:message] = log[MESSAGE] unless log[MESSAGE] =~ /^target.captureRectWithName/ && log[MESSAGE] =~ /switcherScrollView/ end end ret end |