Method: FileList#initialize
- Defined in:
- lib/filelist.rb
#initialize(*patterns) {|_self| ... } ⇒ FileList
Create a file list from the globbable patterns given. If you wish to perform multiple includes or excludes at object build time, use the “yield self” pattern.
Example:
file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
pkg_files = FileList.new('lib/**/*') do |fl|
fl.exclude(/\bCVS\b/)
end
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/filelist.rb', line 98 def initialize(*patterns) @pending_add = [] @pending = false @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup @exclude_procs = DEFAULT_IGNORE_PROCS.dup @exclude_re = nil @items = [] patterns.each { |pattern| include(pattern) } yield self if block_given? end |