Method: FileList#initialize

Defined in:
lib/carat/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

Yields:

  • (_self)

Yield Parameters:

  • _self (FileList)

    the object that the method was called on



58
59
60
61
62
63
64
65
66
# File 'lib/carat/filelist.rb', line 58

def initialize(*patterns)
  @pending_add = []
  @pending = false
  @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
  @exclude_re = nil
#     @extent_only = false
  patterns.each { |pattern| include(pattern) }
  yield self if block_given?
end