Class: Listen::Event::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/listen/event/processor.rb

Defined Under Namespace

Classes: Stopped

Instance Method Summary collapse

Constructor Details

#initialize(config, reasons) ⇒ Processor

Returns a new instance of Processor.



8
9
10
11
12
13
# File 'lib/listen/event/processor.rb', line 8

def initialize(config, reasons)
  @config = config
  @listener = config.listener
  @reasons = reasons
  _reset_no_unprocessed_events
end

Instance Method Details

#loop_for(latency) ⇒ Object

TODO: implement this properly instead of checking the state at arbitrary points in time



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/listen/event/processor.rb', line 17

def loop_for(latency)
  @latency = latency

  loop do
    event = _wait_until_events
    _check_stopped
    _wait_until_events_calm_down
    _wait_until_no_longer_paused
    _process_changes(event)
  end
rescue Stopped
  Listen.logger.debug('Processing stopped')
end