lib/garcon/chef/resource/resource_name.rb
# Maps a resource/provider (and optionally a platform and version) to a
# Chef resource/provider. This allows finer grained per platform
# resource attributes and the end of overloaded resource definitions.
#
# @note
#   The provides method must be defined in both the custom resource and
#   custom provider files and both files must have identical provides
#   statement(s).
#
# @param [Symbol] name
#   Name of a Chef resource/provider to map to.
#
# @return [undefined]
#
Maps a resource/provider (and optionally a platform and version) to a
Chef resource/provider. This allows finer grained per platform
resource attributes and the end of overloaded resource definitions.
Maps a resource / provider ( and optionally a platform and version ) to a Chef resource / provider . This allows finer grained per platform resource attributes and the end of overloaded resource definitions .
def provides(name)
          if self.name && respond_to?(:constantize)
            old_constantize = instance_method(:constantize)
            define_singleton_method(:constantize) do |name|
              name == self.name ? self : old_constantize.bind(self).call(name)
            end
          end
          @provides_name = name
          super if defined?(super)
        end
def provides ( name ) if self . name && respond_to? ( :constantize ) old_constantize = instance_method ( :constantize ) define_singleton_method ( :constantize ) do | name | name == self . name ? self : old_constantize . bind ( self ) . call ( name ) end end @provides_name = name super if defined? ( super ) end
Maps a resource/provider (and optionally a platform and version) to a
Chef resource/provider.
Maps a resource / provider ( and optionally a platform and version ) to a Chef resource / provider .
None
undefined
name
<not_specific>
<not_specific>
name Name of a Chef resource/provider to map to.
name Name of a Chef resource / provider to map to .
note
The provides method must be defined in both the custom resource and custom provider files and both files must have identical provides statement(s).
The provides method must be defined in both the custom resource and custom provider files and both files must have identical provides statement ( s ) .