Method: Puppet::Util::ProviderFeatures#feature
- Defined in:
- lib/puppet/util/provider_features.rb
#feature(name, docs, hash = {}) ⇒ Object
TODO:
How methods that determine if the feature is present are specified.
Defines one feature. At a minimum, a feature requires a name and docs, and at this point they should also specify a list of methods required to determine if the feature is present.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/puppet/util/provider_features.rb', line 64 def feature(name, docs, hash = {}) @features ||= {} raise(Puppet::DevError, "Feature #{name} is already defined") if @features.include?(name) begin obj = ProviderFeature.new(name, docs, hash) @features[obj.name] = obj rescue ArgumentError => detail error = ArgumentError.new( _("Could not create feature %{name}: %{detail}") % { name: name, detail: detail } ) error.set_backtrace(detail.backtrace) raise error end end |