Module: Wunderbar::Listen

Defined in:
lib/wunderbar/listen.rb

Constant Summary collapse

EXCLUDE =
[]

Class Method Summary collapse

Class Method Details

.exclude(*files) ⇒ Object

add a path to the exclude list



28
29
30
31
32
33
# File 'lib/wunderbar/listen.rb', line 28

def self.exclude(*files)
  files.each do |file|
    file = File.realpath(file)
    EXCLUDE << file unless EXCLUDE.include? file
  end
end

.exclude?(files) ⇒ Boolean

check to see if all of the files are excluded

Returns:

  • (Boolean)


36
37
38
39
40
41
42
43
# File 'lib/wunderbar/listen.rb', line 36

def self.exclude?(files)
  files.all? do |file|
    file = File.realpath(file) if File.exist? file
    EXCLUDE.any? do |exclude|
      file == exclude or file.start_with? exclude + '/'
    end
  end
end