#!/usr/bin/env ruby

module Rake
  class FileList < Array
    def initialize(pattern=nil)
      add_matching(pattern) if pattern
    end

    def add(*filenames)
      filenames.each do |fn|
	case fn
	when Array
	  fn.each { |f| self << f }
	else
	  self << fn
	end
      end
    end

    def add_matching(*patterns)
      patterns.each do |pattern|
	Dir[pattern].each { |fn| self << fn } if pattern
      end
    end

    def to_s
      self.join(' ')
    end
  end
end

#!/usr/bin/env ruby

module Rake
  class FileList < Array
    def initialize(pattern=nil)
      add_matching(pattern) if pattern
    end

    def add(*filenames)
      filenames.each do |fn|
	case fn
	when Array
	  fn.each { |f| self.add(f) }
	when %r{[*?]}
	  add_matching(fn)
	else
	  self << fn
	end
      end
    end

    def add_matching(*patterns)
      patterns.each do |pattern|
	Dir[pattern].each { |fn| self << fn } if pattern
      end
    end
    private :add_matching

    def to_s
      self.join(' ')
    end
  end
end

Add now handles patterns as a special case. Add_matching is now private.
Add now handles patterns as a special case.
Add_matching is now private.


git-svn-id: 6a2c20c72ceedae27ecedb68e90cd4f115192a7a@59 5af023f1-ac1a-0410-98d6-829a145c37ef
