Module: Retest::Watcher::Default

Defined in:
lib/retest/watcher.rb

Class Method Summary collapse

Class Method Details

.extensions_regex(extensions) ⇒ Object



33
34
35
# File 'lib/retest/watcher.rb', line 33

def self.extensions_regex(extensions)
  Regexp.new("\\.(?:#{extensions.join("|")})$")
end

.installed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/retest/watcher.rb', line 23

def self.installed?
  true
end

.watch(dir:, extensions:, polling: false) ⇒ Object



27
28
29
30
31
# File 'lib/retest/watcher.rb', line 27

def self.watch(dir:, extensions:, polling: false)
  Listen.to(dir, only: extensions_regex(extensions), relative: true, polling: polling) do |modified, added, removed|
    yield modified, added, removed
  end.start
end