Class: Watchcat::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/watchcat/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, watcher:, paths:, recursive:, force_polling:, poll_interval:, ignore_remove:, debounce:) ⇒ Client

Returns a new instance of Client.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/watchcat/client.rb', line 3

def initialize(uri, watcher:, paths:, recursive:, force_polling:, poll_interval:, ignore_remove:, debounce:)
  DRb.start_service
  @watcher = watcher
  @server = DRbObject.new_with_uri(uri)
  @paths = paths
  @recursive = recursive
  @force_polling = force_polling
  @poll_interval = poll_interval
  @ignore_remove = ignore_remove
  @debounce = debounce
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/watchcat/client.rb', line 15

def run
  @watcher.watch(
    @paths,
    recursive: @recursive,
    force_polling: @force_polling,
    poll_interval: @poll_interval,
    ignore_remove: @ignore_remove,
    debounce: @debounce
  ) { |notification| @server.execute(notification) }
end