class Bake::Base
The base class for including {Scope} instances which define {Recipe} instances.
def self.derive(path = [])
Generate a base class for the specified path.
def self.derive(path = []) klass = Class.new(self) klass.const_set(:PATH, path) return klass end
def self.inspect
def self.inspect if path = self.path "Bake::Base[#{path.join(':')}]" else super end end
def self.path
The path of this derived base class.
def self.path self.const_get(:PATH) rescue nil end
def self.to_s
Format the class as a command.
def self.to_s if path = self.path path.join(":") else super end end
def call(*arguments)
Proxy a method call using command line arguments through to the {Context} instance.
def call(*arguments) self.context.call(*arguments) end
def output?(recipe)
If an instance generates output, it should override this method to return `true`, otherwise default output handling will be used (essentially the return value of the last recipe).
def output?(recipe) false end
def path
The path for this derived base class.
def path self.class.path end
def recipe_for(name)
Look up a recipe with a specific name.
def recipe_for(name) Recipe.new(self, name) end
def recipes
@parameter recipe [Recipe]
@yields {|recipe| ...}
Recipes defined in this scope.
def recipes return to_enum(:recipes) unless block_given? names = self.public_methods - Base.public_instance_methods names.each do |name| yield recipe_for(name) end end
def to_s
def to_s "\#<#{self.class}>" end