module Bake::Scope
Used for containing all methods defined in a bakefile.
Public Class Methods
inspect()
click to toggle source
# File lib/bake/scope.rb, line 41 def self.inspect "Bake::Scope<#{self.const_get(:FILE_PATH)}>" end
load(file_path, path = [])
click to toggle source
Load the specified file into a unique scope module, which can then be included into a {Base} instance.
# File lib/bake/scope.rb, line 29 def self.load(file_path, path = []) scope = Module.new scope.extend(self) scope.const_set(:FILE_PATH, file_path) scope.const_set(:PATH, path) scope.module_eval(File.read(file_path), file_path) return scope end
Public Instance Methods
path()
click to toggle source
The path of the file that was used to {load} this scope.
# File lib/bake/scope.rb, line 61 def path self.const_get(:PATH) end
recipe_for(name)
click to toggle source
Look up a recipe with a specific name.
@parameter name [String] The instance method to look up.
# File lib/bake/scope.rb, line 68 def recipe_for(name) Recipe.new(self, name, self.instance_method(name)) end
recipes() { |recipe_for(name)| ... }
click to toggle source
Recipes defined in this scope.
@yields {|recipe| …}
@parameter recipe [Recipe]
@returns [Enumerable]
# File lib/bake/scope.rb, line 50 def recipes return to_enum(:recipes) unless block_given? names = self.instance_methods names.each do |name| yield recipe_for(name) end end