Sha256: 858fef67836ece06d793aa8e0d7b512c59850509ae8bab57a7cf9498939bdb6d

Contents?: true

Size: 841 Bytes

Versions: 9

Compression:

Stored size: 841 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

Version Path
puppet-strings-2.5.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.4.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.3.1 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.3.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.2.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.1.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-2.0.0 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-1.2.1 lib/puppet-strings/markdown/defined_types.rb
puppet-strings-1.2.0 lib/puppet-strings/markdown/defined_types.rb