class Rails::Paths::Path
def concat(paths)
def concat(paths) @paths.concat paths end
def each
def each to_a.each { |p| yield p } end
def initialize(root, *paths)
def initialize(root, *paths) options = paths.last.is_a?(::Hash) ? paths.pop : {} @children = {} @root = root @paths = paths.flatten @glob = options[:glob] autoload_once! if options[:autoload_once] eager_load! if options[:eager_load] autoload! if options[:autoload] load_path! if options[:load_path] @root.all_paths << self end
def paths
def paths raise "You need to set a path root" unless @root.path result = @paths.map do |p| path = File.expand_path(p, @root.path) @glob ? Dir[File.join(path, @glob)] : path end result.flatten! result.uniq! result end
def push(path)
def push(path) @paths.push path end
def unshift(path)
def unshift(path) @paths.unshift path end