Class: Guard::Polling
- Defined in:
- lib/guard/listeners/polling.rb
Overview
Polling listener that works cross-platform and has no dependencies. This is the listener that uses the most CPU processing power and has higher file IO that the other implementations.
Constant Summary
Constants inherited from Listener
Listener::DEFAULT_IGNORE_PATHS
Instance Attribute Summary
Attributes inherited from Listener
#changed_files, #directory, #ignore_paths
Instance Method Summary collapse
-
#initialize ⇒ Polling
constructor
Initialize the Listener.
-
#start ⇒ Object
Start the listener.
-
#stop ⇒ Object
Stop the listener.
-
#watch(directory) ⇒ Object
Watch the given directory for file changes.
Methods inherited from Listener
#all_files, #clear_changed_files, #exclude_ignored_paths, #modified_files, #on_change, #pause, #paused?, #relativize_paths, #relativize_paths?, #run, select_and_init, #start_reactor, #timestamp_files, #update_last_event
Constructor Details
#initialize ⇒ Polling
Initialize the Listener.
12 13 14 15 |
# File 'lib/guard/listeners/polling.rb', line 12 def initialize(*) super @latency = 1.5 end |
Instance Method Details
#start ⇒ Object
Start the listener.
19 20 21 22 23 |
# File 'lib/guard/listeners/polling.rb', line 19 def start @stop = false super watch_change end |
#stop ⇒ Object
Stop the listener.
27 28 29 30 |
# File 'lib/guard/listeners/polling.rb', line 27 def stop super @stop = true end |
#watch(directory) ⇒ Object
Watch the given directory for file changes.
36 37 38 |
# File 'lib/guard/listeners/polling.rb', line 36 def watch(directory) @existing = all_files end |