Class: Ruote::WaitLogger

Inherits:
TestLogger show all
Defined in:
lib/ruote/log/wait_logger.rb

Overview

A helper logger for quickstart examples.

Keeps a maximum of 147 messages.

Instance Attribute Summary collapse

Attributes inherited from TestLogger

#log, #seen

Instance Method Summary collapse

Methods inherited from TestLogger

#color=, #dump, pp, #wait_for

Constructor Details

#initialize(context) ⇒ WaitLogger

Returns a new instance of WaitLogger.



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ruote/log/wait_logger.rb', line 39

def initialize(context)

  @context = context
  @color = 33

  @context.worker.subscribe(:all, self) if @context.worker

  @noisy = false
  @count = -1

  @seen = []
  @waiting = []
end

Instance Attribute Details

#noisyObject

Returns the value of attribute noisy.



37
38
39
# File 'lib/ruote/log/wait_logger.rb', line 37

def noisy
  @noisy
end

Instance Method Details

#notify(msg) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/ruote/log/wait_logger.rb', line 53

def notify(msg)

  puts(pretty_print(msg)) if @noisy

  @seen << msg if msg['action'] != 'noop'
  @seen.shift if @seen.size > 147

  check_waiting
end