Class: Whisk::Resource

Inherits:
Object
  • Object
show all
Includes:
Chef::Mixin::ParamsValidate
Defined in:
lib/whisk/resource.rb,
lib/whisk/resource/bowl.rb,
lib/whisk/resource/ingredient.rb

Direct Known Subclasses

Bowl, Ingredient

Defined Under Namespace

Classes: Bowl, Ingredient

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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