Class: DirFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/filesystem_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(ignore_list) ⇒ DirFilter

Returns a new instance of DirFilter.



3
4
5
6
# File 'lib/helpers/filesystem_helpers.rb', line 3

def initialize(ignore_list)
  @ignore_list = [ignore_list].flatten
  @ignore_list << /^\./    #ignore dot files
end

Instance Method Details

#filter_entries(path) ⇒ Object



9
10
11
12
13
# File 'lib/helpers/filesystem_helpers.rb', line 9

def filter_entries(path)
  wkg_entries = Dir.entries(path)
  #remove dot files
  wkg_entires = wkg_entries.delete_if{|entry| in_ignore_list?(entry)  }
end