Class: Coyote::FSListeners::Polling

Inherits:
Base
  • Object
show all
Defined in:
lib/coyote/fs_listeners/polling.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#last_event, #sha1_checksums_hash

Instance Method Summary collapse

Methods inherited from Base

#modified_files, #update_last_event

Constructor Details

#initializePolling

Returns a new instance of Polling.



5
6
7
8
# File 'lib/coyote/fs_listeners/polling.rb', line 5

def initialize
  super
  @latency = 1.5
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



3
4
5
# File 'lib/coyote/fs_listeners/polling.rb', line 3

def callback
  @callback
end

#latencyObject (readonly)

Returns the value of attribute latency.



3
4
5
# File 'lib/coyote/fs_listeners/polling.rb', line 3

def latency
  @latency
end

Instance Method Details

#on_change(&callback) ⇒ Object



10
11
12
# File 'lib/coyote/fs_listeners/polling.rb', line 10

def on_change(&callback)
  @callback = callback
end

#startObject



14
15
16
17
# File 'lib/coyote/fs_listeners/polling.rb', line 14

def start
  @stop = false
  watch_change
end

#stopObject



19
20
21
# File 'lib/coyote/fs_listeners/polling.rb', line 19

def stop
  @stop = true
end