class Bake::Base
The base class for including {Scope} instances which define {Recipe} instances.
Public Class Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 14 def self.derive(path = []) klass = Class.new(self) klass.const_set(:PATH, path) return klass end
@parameter path [Array(String)] The command path.
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 32 def self.inspect if path = self.path "Bake::Base[#{path.join(':')}]" else super end end
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 42 def self.path self.const_get(:PATH) rescue nil end
The path of this derived base class. @returns [Array(String)]
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 63 def call(*arguments) self.context.call(*arguments) end
Proxy a method call using command line arguments through to the {Context} instance. @parameter arguments [Array(String)]
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 51 def output?(recipe) false end
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).
@returns [Boolean] Whether this instance handles its own output.
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 57 def path self.class.path end
The path for this derived base class. @returns [Array(String)]
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 85 def recipe_for(name) Recipe.new(self, name) end
Look up a recipe with a specific name.
@parameter name [String] The instance method to look up.
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 72 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
Recipes defined in this scope.
@yields {|recipe| …}
@parameter recipe [Recipe]
@returns [Enumerable]
Source
# File vendor/bundle/ruby/4.0.0/gems/bake-0.24.1/lib/bake/base.rb, line 89 def to_s "\#<#{self.class}>" end