Class: DataCollector::Input::Dir

Inherits:
Generic
  • Object
show all
Defined in:
lib/data_collector/input/dir.rb

Instance Method Summary collapse

Methods inherited from Generic

#on_message, #pause, #paused?, #stop, #stopped?

Constructor Details

#initialize(uri, options = {}) ⇒ Dir

Returns a new instance of Dir.



7
8
9
# File 'lib/data_collector/input/dir.rb', line 7

def initialize(uri, options = {})
  super
end

Instance Method Details

#run(should_block = false, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/data_collector/input/dir.rb', line 11

def run(should_block = false, &block)
  @listener.start unless running?
  if block_given?
    while should_block && !paused?
      yield
    end
  else
    sleep if should_block && running? && !paused?
  end
end

#running?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/data_collector/input/dir.rb', line 22

def running?
  @listener.processing?
end