class DirFilter

Public Class Methods

new(ignore_list) click to toggle source
# File lib/helpers/filesystem_helpers.rb, line 3
def initialize(ignore_list)
  @ignore_list = [ignore_list].flatten
  @ignore_list << /^\./    #ignore dot files
end

Public Instance Methods

filter_entries(path) click to toggle source
# 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

Private Instance Methods

in_ignore_list?(entry) click to toggle source
# File lib/helpers/filesystem_helpers.rb, line 16
def in_ignore_list?(entry)
  in_ignore = @ignore_list.map{|list| true if entry =~ list}
  in_ignore.compact.first  #nil if nothing in ignore
end