Class: PuppetStrings::Yard::Tags::ParameterDirective
- Inherits:
-
YARD::Tags::Directive
- Object
- YARD::Tags::Directive
- PuppetStrings::Yard::Tags::ParameterDirective
- Defined in:
- lib/puppet-strings/yard/tags/parameter_directive.rb
Overview
Implements a parameter directive (e.g. #@!puppet.type.param) for documenting Puppet resource types.
Class Method Summary collapse
-
.register! ⇒ void
Registers the directive with YARD.
Instance Method Summary collapse
-
#call ⇒ void
Called to invoke the directive.
Class Method Details
.register! ⇒ void
This method returns an undefined value.
Registers the directive with YARD.
21 22 23 |
# 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 |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Called to invoke the directive.
7 8 9 10 11 12 13 14 15 16 17 |
# 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 |