Class: Bake::Registry::FileLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/bake/registry/directory_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ FileLoader

Returns a new instance of FileLoader.



54
55
56
# File 'lib/bake/registry/directory_loader.rb', line 54

def initialize(paths)
	@paths = paths
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



62
63
64
# File 'lib/bake/registry/directory_loader.rb', line 62

def paths
  @paths
end

Instance Method Details

#each(&block) ⇒ Object



64
65
66
# File 'lib/bake/registry/directory_loader.rb', line 64

def each(&block)
	@paths.each_key(&block)
end

#scope_for(path) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/bake/registry/directory_loader.rb', line 68

def scope_for(path)
	if file_path = @paths[path]
		if File.exist?(file_path)
			return Scope.load(file_path, path)
		end
	end
end

#to_sObject



58
59
60
# File 'lib/bake/registry/directory_loader.rb', line 58

def to_s
	"#{self.class} #{@paths}"
end