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 18 def initialize(basedir = '.') 19 @dir = basedir 20 @includes, @excludes = [], [] 21 end
Public Instance Methods
exclude(*patterns)
click to toggle source
Specify glob patterns or regexps to exclude
# File lib/rote/rotetasks.rb 38 def exclude(*patterns) 39 patterns.each { |it| 40 @excludes << it 41 } 42 end
include(*patterns)
click to toggle source
Specify glob patterns to include
# File lib/rote/rotetasks.rb 31 def include(*patterns) 32 patterns.each { |it| 33 @includes << it 34 } 35 end
to_filelist()
click to toggle source
Create a FileList
with these patterns
# File lib/rote/rotetasks.rb 45 def to_filelist 46 fl = FileList.new 47 fl.include(*includes.map { |it| "#{dir}/#{it}"} ) unless includes.empty? 48 49 # excludes may be regexp too 50 fl.exclude(*excludes.map { |it| it.is_a?(String) ? "#{dir}/#{it}" : it } ) unless excludes.empty? 51 52 # don't allow dir to be changed anymore. 53 freeze 54 55 fl 56 end