class PuppetStrings::Yard::CodeObjects::Provider
Implements the Puppet
provider code object.
Attributes
Public Class Methods
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 30 def initialize(type_name, name) @type_name = type_name super(PuppetStrings::Yard::CodeObjects::Providers.instance(type_name), name) end
Initializes a Puppet
provider code object. @param [String] type_name
The resource type name for the provider. @param [String] name The name of the provider.s @return [void]
PuppetStrings::Yard::CodeObjects::Base::new
Public Instance Methods
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 76 def add_command(key, value) return unless key && value @commands ||= {} @commands[key] = value end
Adds a command to the provider. @param [String] key The command’s key. @param [String] value The command’s value. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 45 def add_confine(key, value) return unless key && value @confines ||= {} @confines[key] = value end
Adds a confine to the provider. @param [String] key The confine’s key. @param [String] value The confine’s value. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 65 def add_default(constraints) return unless constraints @defaults ||= [] @defaults << constraints end
Adds a default to the provider. @param [Array] constraints List of related key-pair values for the default. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 55 def add_feature(feature) return unless feature @features ||= [] @features << feature end
Adds a feature to the provider. @param [String] feature The feature to add to the provider. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 85 def to_hash hash = {} hash[:name] = name hash[:type_name] = type_name hash[:file] = file hash[:line] = line hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring) hash[:confines] = confines if confines && !confines.empty? hash[:features] = features if features && !features.empty? hash[:defaults] = defaults if defaults && !defaults.empty? hash[:commands] = commands if commands && !commands.empty? hash end
Converts the code object to a hash representation. @return [Hash] Returns a hash representation of the code object.
Source
# File lib/puppet-strings/yard/code_objects/provider.rb, line 37 def type :puppet_provider end
Gets the type of the code object. @return Returns the type of the code object.