Class: DataCollector::Input::Dir
- Defined in:
- lib/data_collector/input/dir.rb
Instance Method Summary collapse
-
#initialize(uri, options = {}) ⇒ Dir
constructor
A new instance of Dir.
- #run(should_block = false, &block) ⇒ Object
- #running? ⇒ Boolean
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, = {}) 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
22 23 24 |
# File 'lib/data_collector/input/dir.rb', line 22 def running? @listener.processing? end |