Class: Whisk::Resource
- Inherits:
-
Object
- Object
- Whisk::Resource
- Includes:
- Chef::Mixin::ParamsValidate
- Defined in:
- lib/whisk/resource.rb,
lib/whisk/resource/bowl.rb,
lib/whisk/resource/ingredient.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Bowl, Ingredient
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider(arg = nil) ⇒ Object
Returns the value of attribute provider.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Resource
constructor
A new instance of Resource.
- #run_action(action) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Resource
Returns a new instance of Resource.
33 34 35 36 37 |
# File 'lib/whisk/resource.rb', line 33 def initialize(name, &block) @name = name instance_eval(&block) if block_given? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/whisk/resource.rb', line 30 def name @name end |
#provider(arg = nil) ⇒ Object
Returns the value of attribute provider.
31 32 33 |
# File 'lib/whisk/resource.rb', line 31 def provider @provider end |
Instance Method Details
#run_action(action) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/whisk/resource.rb', line 47 def run_action(action) if self.provider provider = self.provider.new(self) provider.send("action_#{action}") end end |