# Copyright (c) 2010-2011 David Love # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the # above copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # @author David Love module WhiteCloth::Projections # Create a Projection for the specified directory class DirFile # Default constructor def initialize @file_stack = WhiteCloth::DataStructures::FlatTree.new end # Run the projection function, taking +path+ as the {File#glob} # shell glob for the path and pattern to match # when looking for files def project(path) # Walk the path, Dir.glob(path){|file_name| # Ignore directories unless File.directory?(file_name) then # Ignore the special files as well unless file_name == "." or file_name == ".." then end end } end end end