Class: Whisk::Resource::Bowl
- Inherits:
-
Whisk::Resource
- Object
- Whisk::Resource
- Whisk::Resource::Bowl
- Defined in:
- lib/whisk/resource/bowl.rb
Instance Attribute Summary collapse
-
#ingredients ⇒ Object
readonly
Returns the value of attribute ingredients.
Attributes inherited from Whisk::Resource
Instance Method Summary collapse
- #environment(arg = nil) ⇒ Object
- #ingredient(iname, &block) ⇒ Object
-
#initialize(name, &block) ⇒ Bowl
constructor
A new instance of Bowl.
- #path(arg = nil) ⇒ Object
- #refs_from_environment(arg = nil) ⇒ Object
Methods inherited from Whisk::Resource
Constructor Details
Instance Attribute Details
#ingredients ⇒ Object (readonly)
Returns the value of attribute ingredients.
27 28 29 |
# File 'lib/whisk/resource/bowl.rb', line 27 def ingredients @ingredients end |
Instance Method Details
#environment(arg = nil) ⇒ Object
47 48 49 |
# File 'lib/whisk/resource/bowl.rb', line 47 def environment(arg=nil) set_or_return(:environment, arg, :kind_of => String) end |
#ingredient(iname, &block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/whisk/resource/bowl.rb', line 36 def ingredient(iname, &block) if ingredients.has_key? iname raise ArgumentError, "Ingredient '#{iname}' has already been added to bowl '#{name}'" else ingredients[iname] = Whisk::Resource::Ingredient.new(iname, self, &block) if refs_from_environment ingredients[iname].ref :ref_from_environment end end end |
#path(arg = nil) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/whisk/resource/bowl.rb', line 51 def path(arg=nil) if arg path = File.(arg) else path = nil end set_or_return(:path, path, :default => File.(File.join(Dir.getwd, name))) end |
#refs_from_environment(arg = nil) ⇒ Object
60 61 62 |
# File 'lib/whisk/resource/bowl.rb', line 60 def refs_from_environment(arg=nil) set_or_return(:refs_from_environment, arg, :kind_of => [TrueClass, FalseClass], :default => false) end |