class Rote::FilePatterns

Just a temporary holder for a set of patterns that are used to construct a relative FileList for pages and resources.

Attributes

dir[RW]

Access the base dir for these patterns

excludes[R]
includes[R]

Access the pattern arrays

Public Class Methods

new(basedir = '.') click to toggle source
# File lib/rote/rotetasks.rb, line 18
def initialize(basedir = '.')
  @dir = basedir    
  @includes, @excludes = [], []
end

Public Instance Methods

exclude(*patterns) click to toggle source

Specify glob patterns or regexps to exclude

# File lib/rote/rotetasks.rb, line 38
def exclude(*patterns)
  patterns.each { |it|         
    @excludes << it
  }
end
include(*patterns) click to toggle source

Specify glob patterns to include

# File lib/rote/rotetasks.rb, line 31
def include(*patterns)
  patterns.each { |it| 
    @includes << it
  }
end
to_filelist() click to toggle source

Create a FileList with these patterns

# File lib/rote/rotetasks.rb, line 45
def to_filelist
  fl = FileList.new
  fl.include(*includes.map { |it| "#{dir}/#{it}"} ) unless includes.empty?

  # excludes may be regexp too
  fl.exclude(*excludes.map { |it| it.is_a?(String) ? "#{dir}/#{it}" : it } ) unless excludes.empty?
  
  # don't allow dir to be changed anymore. 
  freeze
     
  fl    
end