Method: Chef::Resource#provider

Defined in:
lib/chef/resource.rb

#provider(arg = nil) ⇒ Object

The provider class for this resource.

If ‘action :x do … end` has been declared on this resource or its superclasses, this will return the action_class.

If this is not set, provider_for_action will dynamically determine the provider.

Parameters:

  • arg (String, Symbol, Class) (defaults to: nil)

    Sets the provider class for this resource. If passed a String or Symbol, e.g. :file or ‘“file”`, looks up the provider based on the name.

Returns:

  • The provider class for this resource.

See Also:



777
778
779
780
781
782
783
784
# File 'lib/chef/resource.rb', line 777

def provider(arg = nil)
  klass = if arg.is_a?(String) || arg.is_a?(Symbol)
            lookup_provider_constant(arg)
          else
            arg
          end
  set_or_return(:provider, klass, kind_of: [ Class ])
end