This class is used to read source paths from a directory in the file system.
The glob (see Dir.glob for details) that is used to specify which paths under the root path should be returned by #.
Create a new file system source for the root path root using the provided glob.
# File lib/webgen/source/filesystem.rb, line 39 39: def initialize(root, glob = '**/*') 40: if root =~ /^([a-zA-Z]:|\/)/ 41: @root = root 42: else 43: @root = File.join(WebsiteAccess.website.directory, root) 44: end 45: @glob = glob 46: end
Return all paths under # which match #.
# File lib/webgen/source/filesystem.rb, line 49 49: def paths 50: @paths ||= Dir.glob(File.join(@root, @glob), File::FNM_DOTMATCH|File::FNM_CASEFOLD).to_set.collect do |f| 51: next unless File.exists?(f) # handle invalid links 52: temp = Pathname.new(f.sub(/^#{Regexp.escape(@root)}\/?/, '/')).cleanpath.to_s 53: temp += '/' if File.directory?(f) && temp[1] != // 54: path = Path.new(temp, f) 55: path 56: end.compact 57: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.