Method: FileList#exclude
- Defined in:
- lib/mega/filelist.rb
#exclude(*patterns) ⇒ Object
Register a list of file name patterns that should be excluded from the list. Patterns may be regular expressions, glob patterns or regular strings.
Note that glob patterns are expanded against the file system. If a file is explicitly added to a file list, but does not exist in the file system, then an glob pattern in the exclude list will not exclude the file.
Examples:
FileList['a.c', 'b.c'].exclude("a.c") => ['b.c']
FileList['a.c', 'b.c'].exclude(/^a/) => ['b.c']
If “a.c” is a file, then …
FileList['a.c', 'b.c'].exclude("a.*") => ['b.c']
If “a.c” is not a file, then …
FileList['a.c', 'b.c'].exclude("a.*") => ['a.c', 'b.c']
118 119 120 121 122 123 124 125 |
# File 'lib/mega/filelist.rb', line 118 def exclude(*patterns) # TODO: check for pending patterns.compact.each { |pat| @exclude_patterns << pat } if ! @pending calculate_exclude_regexp reject! { |fn| fn =~ @exclude_re } end end |