Sha256: 62b31207df8ad36b4ee0a295d460b94658ef200b4e4e59e5e198244d73f61a70

Contents?: true

Size: 872 Bytes

Versions: 4

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true

require_relative 'defined_type'

module PuppetStrings::Markdown
  module DefinedTypes

    # @return [Array] list of defined types
    def self.in_dtypes
      arr = YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash)
      arr.map! { |a| PuppetStrings::Markdown::DefinedType.new(a) }
    end

    def self.contains_private?
      result = false
      unless in_dtypes.nil?
        in_dtypes.find { |type| type.private? }.nil? ? false : true
      end
    end

    def self.render
      final = in_dtypes.length > 0 ? "## Defined types\n\n" : ""
      in_dtypes.each do |type|
        final += type.render unless type.private?
      end
      final
    end

    def self.toc_info
      final = ["Defined types"]

      in_dtypes.each do |type|
        final.push(type.toc_info)
      end

      final
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-strings-2.9.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.8.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.7.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.6.0 lib/puppet-strings/markdown/defined_types.rb