class Puppet::Util::ProviderFeatures::ProviderFeature

This class models provider features and handles checking whether the features are present. @todo Unclear what is api and what is private in this class

Attributes

docs[RW]
methods[RW]
name[RW]

Public Class Methods

new(name, docs, hash) click to toggle source
# File lib/puppet/util/provider_features.rb, line 35
def initialize(name, docs, hash)
  self.name = name.intern
  self.docs = docs
  hash = symbolize_options(hash)
  set_options(hash)
end

Public Instance Methods

available?(obj) click to toggle source

Are all of the requirements met? Requirements are checked by checking if feature predicate methods have been generated - see {#methods_available?}. @param obj [Object, Class] the object or class to check if requirements are met @return [Boolean] whether all requirements for this feature are met or not.

# File lib/puppet/util/provider_features.rb, line 24
def available?(obj)
  if self.methods
    return !!methods_available?(obj)
  else
    # In this case, the provider has to declare support for this
    # feature, and that's been checked before we ever get to the
    # method checks.
    return false
  end
end