Class: Whisk::Resource::Ingredient
- Inherits:
-
Whisk::Resource
- Object
- Whisk::Resource
- Whisk::Resource::Ingredient
- Includes:
- Chef::Mixin::ParamsValidate
- Defined in:
- lib/whisk/resource/ingredient.rb
Instance Attribute Summary collapse
-
#bowl ⇒ Object
Returns the value of attribute bowl.
-
#remotes ⇒ Object
Returns the value of attribute remotes.
Attributes inherited from Whisk::Resource
Instance Method Summary collapse
-
#initialize(name, bowl, &block) ⇒ Ingredient
constructor
A new instance of Ingredient.
- #path ⇒ Object
- #ref(arg = nil) ⇒ Object
- #remote(rname, url) ⇒ Object
- #source(arg = nil) ⇒ Object
Methods inherited from Whisk::Resource
Constructor Details
#initialize(name, bowl, &block) ⇒ Ingredient
Returns a new instance of Ingredient.
30 31 32 33 34 35 36 37 38 |
# File 'lib/whisk/resource/ingredient.rb', line 30 def initialize(name, bowl, &block) @bowl = bowl @provider = Whisk::Provider::Ingredient @ref = nil @remotes = {} @source = nil super(name, &block) end |
Instance Attribute Details
#bowl ⇒ Object
Returns the value of attribute bowl.
28 29 30 |
# File 'lib/whisk/resource/ingredient.rb', line 28 def bowl @bowl end |
#remotes ⇒ Object
Returns the value of attribute remotes.
28 29 30 |
# File 'lib/whisk/resource/ingredient.rb', line 28 def remotes @remotes end |
Instance Method Details
#path ⇒ Object
40 41 42 |
# File 'lib/whisk/resource/ingredient.rb', line 40 def path File.join(self.bowl.path, self.name) end |
#ref(arg = nil) ⇒ Object
48 49 50 |
# File 'lib/whisk/resource/ingredient.rb', line 48 def ref(arg=nil) set_or_return(:ref, arg, :kind_of => [String, Symbol]) end |
#remote(rname, url) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/whisk/resource/ingredient.rb', line 52 def remote(rname, url) if remotes.has_key?(name) raise ArgumentError, "remote #{rname} already defined for ingredient #{name}" else remotes[rname] = url end end |
#source(arg = nil) ⇒ Object
44 45 46 |
# File 'lib/whisk/resource/ingredient.rb', line 44 def source(arg=nil) set_or_return(:source, arg, :required => true) end |