class Bake::Base

The base class for including {Scope} instances which define {Recipe} instances.

def self.derive(path = [])

@parameter path [Array(String)] The command 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

@returns [Array(String)]
The path of this derived base class.
def self.path
	self.const_get(:PATH)
rescue
	nil
end

def self.to_s

@returns [String]
Format the class as a command.
def self.to_s
	if path = self.path
		path.join(":")
	else
		super
	end
end

def call(*arguments)

@parameter arguments [Array(String)]
Proxy a method call using command line arguments through to the {Context} instance.
def call(*arguments)
	self.context.call(*arguments)
end

def path

@returns [Array(String)]
The path for this derived base class.
def path
	self.class.path
end

def recipe_for(name)

@parameter name [String] The instance method to look up.

Look up a recipe with a specific name.
def recipe_for(name)
	Recipe.new(self, name)
end

def recipes

@returns [Enumerable]
@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