Module: Garcon::Resource::Blender

Extended by:
ClassMethods
Defined in:
lib/garcon/chef/resource/blender.rb

Overview

Combine a resource and provider class for quick and easy oven baked goodness. Never has cooking been this fun since the invention of the grocery store!

Examples:

class Chef::Resource::HouseKeeping < Chef::Resource
  include Garcon(blender: true)

  attribute :path,
    kind_of: String,
    name_attribute: true
  attribute :message,
    kind_of: String,
    default: 'Clean the kitchen'

  action :run do
    file new_resource.path do
      content new_resource.message
    end
  end
end

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ClassMethods

action, blender_actions, blender_provider_class, included

Instance Method Details

#is_a?(klass) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Coerce is_a? so that the DSL will consider this a Provider for the purposes of attaching enclosing_provider.

Parameters:

  • klass (Class)

Returns:



55
56
57
# File 'lib/garcon/chef/resource/blender.rb', line 55

def is_a?(klass)
  klass == Chef::Provider ? true : super
end

#provider_for_action(action) ⇒ Chef::Provider

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Coerce provider_for_action so that the resource is also the provider.

Parameters:

Returns:



66
67
68
69
# File 'lib/garcon/chef/resource/blender.rb', line 66

def provider_for_action(action)
  provider(self.class.blender_provider_class) unless provider
  super
end