Class: Bake::Base
- Inherits:
-
Struct
- Object
- Struct
- Bake::Base
- Defined in:
- lib/bake/base.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
25 26 27 |
# File 'lib/bake/base.rb', line 25 def context @context end |
Class Method Details
.derive(path = []) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/bake/base.rb', line 26 def self.derive(path = []) klass = Class.new(self) klass.const_set(:PATH, path) return klass end |
.inspect ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/bake/base.rb', line 42 def self.inspect if path = self.path "Bake::Base<#{path.join(':')}>" else super end end |
.path ⇒ Object
50 51 52 53 54 |
# File 'lib/bake/base.rb', line 50 def self.path self.const_get(:PATH) rescue nil end |
.to_s ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/bake/base.rb', line 34 def self.to_s if path = self.path path.join(':') else super end end |
Instance Method Details
#call(*arguments) ⇒ Object
60 61 62 |
# File 'lib/bake/base.rb', line 60 def call(*arguments) self.context.call(*arguments) end |
#path ⇒ Object
56 57 58 |
# File 'lib/bake/base.rb', line 56 def path self.class.path end |
#recipe_for(name) ⇒ Object
74 75 76 |
# File 'lib/bake/base.rb', line 74 def recipe_for(name) Recipe.new(self, name) end |
#recipes ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/bake/base.rb', line 64 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 |