class Bake::Loader
def each
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)
def initialize(root, name: nil) @root = root @name = name end
def recipe_for(path)
def recipe_for(path) if book = lookup(path) return book.lookup(path.last) else *path, name = *path if book = lookup(path) return book.lookup(name) end end end
def scope_for(path)
def scope_for(path) *directory, file = *path file_path = File.join(@root, directory, "#{file}.rb") if File.exist?(file_path) return Scope.load(file_path, path) end end
def to_s
def to_s "#{self.class} #{@name || @root}" end