Class: Cruise::Watcher

Inherits:
Object
  • Object
show all
Defined in:
lib/cruise/watcher.rb,
ext/cruise/cruise.c

Instance Method Summary collapse

Constructor Details

#initialize(*paths, glob: nil, debounce: DEFAULT_DEBOUNCE, only: nil) ⇒ Watcher

Returns a new instance of Watcher.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
# File 'lib/cruise/watcher.rb', line 5

def initialize(*paths, glob: nil, debounce: DEFAULT_DEBOUNCE, only: nil)
  paths = paths.flatten.grep(String)

  raise ArgumentError, "Cruise::Watcher requires at least one path" if paths.empty?

  glob_patterns = glob ? Array(glob) : []
  only_kinds = only ? Array(only).map(&:to_s) : []

  initialize_native(paths, debounce.to_f, glob_patterns, only_kinds)
end

Instance Method Details

#closeObject

watcher.close



130
131
132
# File 'ext/cruise/cruise.c', line 130

def close
  raise NotImplementedError, "Cruise::Watcher#close is provided by the native extension"
end

#ioObject

watcher.io



106
107
108
# File 'ext/cruise/cruise.c', line 106

def io
  raise NotImplementedError, "Cruise::Watcher#io is provided by the native extension"
end

#pollObject

watcher.poll



111
112
113
# File 'ext/cruise/cruise.c', line 111

def poll
  raise NotImplementedError, "Cruise::Watcher#poll is provided by the native extension"
end