class Bake::Base
The base class for including {Scope} instances which define {Recipe} instances.
Public Class Methods
derive(path = [])
click to toggle source
@parameter path [Array(String)] The command path.
# File lib/bake/base.rb, line 31 def self.derive(path = []) klass = Class.new(self) klass.const_set(:PATH, path) return klass end
inspect()
click to toggle source
Calls superclass method
# File lib/bake/base.rb, line 49 def self.inspect if path = self.path "Bake::Base<#{path.join(':')}>" else super end end
path()
click to toggle source
The path of this derived base class. @returns [Array(String)]
# File lib/bake/base.rb, line 59 def self.path self.const_get(:PATH) rescue nil end
to_s()
click to toggle source
Format the class as a command. @returns [String]
Calls superclass method
# File lib/bake/base.rb, line 41 def self.to_s if path = self.path path.join(':') else super end end
Public Instance Methods
call(*arguments)
click to toggle source
Proxy a method call using command line arguments through to the {Context} instance. @parameter arguments [Array(String)]
# File lib/bake/base.rb, line 73 def call(*arguments) self.context.call(*arguments) end
path()
click to toggle source
The path for this derived base class. @returns [Array(String)]
# File lib/bake/base.rb, line 67 def path self.class.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/base.rb, line 95 def recipe_for(name) Recipe.new(self, 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/base.rb, line 82 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
to_s()
click to toggle source
# File lib/bake/base.rb, line 99 def to_s "\#<#{self.class}>" end