Class: DirectoryWatcher::CoolioScanner
- Inherits:
-
EventableScanner
- Object
- EventableScanner
- DirectoryWatcher::CoolioScanner
- Defined in:
- lib/directory_watcher/coolio_scanner.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from EventableScanner
#iterations, #maximum_iterations, #watchers
Instance Method Summary (collapse)
-
- (Object) event_loop
Return the cool.io loop object.
-
- (CoolioScanner) initialize(config)
constructor
A new instance of CoolioScanner.
- - (Object) start_loop_with_attached_scan_timer
-
- (Object) stop_loop
Called by EventableScanner#stop to stop the loop as part of the shutdown process.
Methods inherited from EventableScanner
#collection_queue, #finished_iterations?, #interval, #join, #on_modified, #on_removed, #on_scan, #pause, #paused?, #resume, #run, #running?, #start, #stop
Methods included from Logable
Constructor Details
- (CoolioScanner) initialize(config)
A new instance of CoolioScanner
24 25 26 |
# File 'lib/directory_watcher/coolio_scanner.rb', line 24 def initialize( config ) super(config) end |
Instance Method Details
- (Object) event_loop
Return the cool.io loop object.
This is used during the startup, shutdown process and for the Watcher to attach and detach from the event loop
56 57 58 59 60 61 62 |
# File 'lib/directory_watcher/coolio_scanner.rb', line 56 def event_loop if @loop_thread then @loop_thread._coolio_loop else Thread.current._coolio_loop end end |
- (Object) start_loop_with_attached_scan_timer
31 32 33 34 35 36 37 38 |
# File 'lib/directory_watcher/coolio_scanner.rb', line 31 def start_loop_with_attached_scan_timer return if @loop_thread @timer = ScanTimer.new( self ) @loop_thread = Thread.new { @timer.attach(event_loop) event_loop.run } end |
- (Object) stop_loop
Called by EventableScanner#stop to stop the loop as part of the shutdown process.
43 44 45 46 47 48 49 |
# File 'lib/directory_watcher/coolio_scanner.rb', line 43 def stop_loop if @loop_thread then event_loop.stop rescue nil @loop_thread.kill @loop_thread = nil end end |