class PuppetStrings::Yard::Tags::ParameterDirective

Implements a parameter directive (e.g. #@!puppet.type.param) for documenting Puppet resource types.

Public Class Methods

register!() click to toggle source

Registers the directive with YARD. @return [void]

# File lib/puppet-strings/yard/tags/parameter_directive.rb, line 21
def self.register!
  YARD::Tags::Library.define_directive('puppet.type.param', :with_types_and_name, self)
end

Public Instance Methods

call() click to toggle source

Called to invoke the directive. @return [void]

# File lib/puppet-strings/yard/tags/parameter_directive.rb, line 7
def call
  return unless object && object.respond_to?(:add_parameter)
  # Add a parameter to the resource
  parameter = PuppetStrings::Yard::CodeObjects::Type::Parameter.new(tag.name, tag.text)
  if tag.types
    tag.types.each do |value|
      parameter.add(value)
    end
  end
  object.add_parameter parameter
end