class PuppetStrings::Yard::CodeObjects::Type::Parameter
Represents a resource type parameter.
Attributes
Public Class Methods
Source
# File lib/puppet-strings/yard/code_objects/type.rb, line 32 def initialize(name, docstring = nil) @name = name @docstring = docstring || '' @values = [] @data_type = [] @aliases = {} @isnamevar = false @default = nil end
Initializes a resource type parameter or property. @param [String] name The name of the parameter or property. @param [String] docstring The docstring for the parameter or property.s
Public Instance Methods
Source
# File lib/puppet-strings/yard/code_objects/type.rb, line 45 def add(value) @values << value end
Adds a value to the parameter or property. @param [String] value The value to add. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/type.rb, line 53 def alias(new, old) @values << new unless @values.include? new @aliases[new] = old end
Aliases a value to another value. @param [String] new The new (alias) value. @param [String] old The old (existing) value. @return [void]
Source
# File lib/puppet-strings/yard/code_objects/type.rb, line 60 def to_hash hash = {} hash[:name] = name hash[:description] = docstring unless docstring.empty? hash[:values] = values unless values.empty? hash[:data_type] = data_type unless data_type.empty? hash[:aliases] = aliases unless aliases.empty? hash[:isnamevar] = true if isnamevar hash[:required_features] = required_features if required_features hash[:default] = default if default hash end
Converts the parameter to a hash representation. @return [Hash] Returns a hash representation of the parameter.