class ChefCompat::Resource

Public Class Methods

new(*args, &block) click to toggle source
# File files/lib/chef_compat/resource.rb, line 13
def initialize(*args, &block)
  super
  # @resource_name is used in earlier Chef versions
  @resource_name = self.class.resource_name
end
resource_name(name=Chef::NOT_PASSED) click to toggle source
# File files/lib/chef_compat/resource.rb, line 30
    def self.resource_name(name=Chef::NOT_PASSED)
      # Setter
      if name != Chef::NOT_PASSED
#        remove_canonical_dsl

        # Set the resource_name and call provides
        if name
          name = name.to_sym
          # If our class is not already providing this name, provide it.
          # Commented out: use of resource_name and provides will need to be
          # mutually exclusive in this world, generally.
          # if !Chef::ResourceResolver.includes_handler?(name, self)
            provides name#, canonical: true
          # end
          @resource_name = name
        else
          @resource_name = nil
        end
      end
      @resource_name
    end
resource_name=(name) click to toggle source
# File files/lib/chef_compat/resource.rb, line 51
def self.resource_name=(name)
  resource_name(name)
end

Public Instance Methods

provider(*args, &block) click to toggle source

Things we'll need to define ourselves:

  1. provider

  2. resource_name

Calls superclass method
# File files/lib/chef_compat/resource.rb, line 22
def provider(*args, &block)
  super || self.class.action_class
end
provider=(arg) click to toggle source
# File files/lib/chef_compat/resource.rb, line 25
def provider=(arg)
  provider(arg)
end