Class: Puppet::Util::ProviderFeatures::ProviderFeature

Inherits:
Object
  • Object
show all
Includes:
Puppet::Util, Docs, MethodHelper
Defined in:
lib/vendor/puppet/util/provider_features.rb

Overview

The class that models the features and handles checking whether the features are present.

Constant Summary

Constants included from Docs

Docs::HEADER_LEVELS

Constants included from Puppet::Util

AbsolutePathPosix, AbsolutePathWindows

Instance Attribute Summary collapse

Attributes included from Docs

#doc, #nodoc

Instance Method Summary collapse

Methods included from Docs

#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub

Methods included from MethodHelper

#requiredopts, #set_options, #symbolize_options

Methods included from Puppet::Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask

Methods included from Puppet::Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Constructor Details

#initialize(name, docs, hash) ⇒ ProviderFeature

Returns a new instance of ProviderFeature.



27
28
29
30
31
32
# File 'lib/vendor/puppet/util/provider_features.rb', line 27

def initialize(name, docs, hash)
  self.name = name.intern
  self.docs = docs
  hash = symbolize_options(hash)
  set_options(hash)
end

Instance Attribute Details

#docsObject

Returns the value of attribute docs.



13
14
15
# File 'lib/vendor/puppet/util/provider_features.rb', line 13

def docs
  @docs
end

#methodsObject

Returns the value of attribute methods.



13
14
15
# File 'lib/vendor/puppet/util/provider_features.rb', line 13

def methods
  @methods
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/vendor/puppet/util/provider_features.rb', line 13

def name
  @name
end

Instance Method Details

#available?(obj) ⇒ Boolean

Are all of the requirements met?

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
# File 'lib/vendor/puppet/util/provider_features.rb', line 16

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