class Bake::Registry::DirectoryLoader
Represents a directory which contains bakefiles.
def each
@yields {|path| ...}
You can pass the yielded path to {scope_for} to load the corresponding {Scope}.
Enumerate all bakefiles within the loaders root directory.
def each return to_enum unless block_given? Dir.glob("**/*.rb", base: @root) do |file_path| yield file_path.sub(/\.rb$/, "").split(File::SEPARATOR) end end
def initialize(root, name: nil)
Initialize the loader with the specified root path.
def initialize(root, name: nil) @root = root @name = name end
def scopes_for(path)
Load the {Scope} for the specified relative path within this loader, if it exists.
def scopes_for(path) *directory, file = *path file_path = File.join(@root, directory, "#{file}.rb") if File.exist?(file_path) yield Scope.load(file_path, path) end end
def to_s
def to_s "#{self.class} #{@name || @root}" end