Sha256: 54ec4b80bde51f307bbdad016e9d42d18d465cdd25fb017d9b9af1174e3c9b4c

Contents?: true

Size: 794 Bytes

Versions: 13

Compression:

Stored size: 794 Bytes

Contents

require 'puppet-strings/yard/code_objects'

# Implements a parameter directive (e.g. #@!puppet.type.property) for documenting Puppet resource types.
class PuppetStrings::Yard::Tags::PropertyDirective < YARD::Tags::Directive
  # Called to invoke the directive.
  # @return [void]
  def call
    return unless object && object.respond_to?(:add_property)
    # Add a property to the resource
    property = PuppetStrings::Yard::CodeObjects::Type::Property.new(tag.name, tag.text)
    if tag.types
      tag.types.each do |value|
        property.add(value)
      end
    end
    object.add_property property
  end

  # Registers the directive with YARD.
  # @return [void]
  def self.register!
    YARD::Tags::Library.define_directive('puppet.type.property', :with_types_and_name, self)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
puppet-strings-2.5.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.4.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.3.1 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.3.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.2.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.1.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-2.0.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-1.2.1 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-1.2.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-1.1.1 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-1.1.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-1.0.0 lib/puppet-strings/yard/tags/property_directive.rb
puppet-strings-0.99.0 lib/puppet-strings/yard/tags/property_directive.rb