Sha256: 2fc179d37d53361e89a185c7c3a7c935b961ec02ea69af609ace7ef402836434

Contents?: true

Size: 931 Bytes

Versions: 4

Compression:

Stored size: 931 Bytes

Contents

require_relative 'data_type'

module PuppetStrings::Markdown
  module DataTypes

    # @return [Array] list of data types
    def self.in_dtypes
      arr = YARD::Registry.all(:puppet_data_type).map!(&:to_hash)
      arr.concat(YARD::Registry.all(:puppet_data_type_alias).map!(&:to_hash))

      arr.sort! { |a,b| a[:name] <=> b[:name] }
      arr.map! { |a| PuppetStrings::Markdown::DataType.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 ? "## Data types\n\n" : ""
      in_dtypes.each do |type|
        final << type.render unless type.private?
      end
      final
    end


    def self.toc_info
      final = ["Data 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.5.0 lib/puppet-strings/markdown/data_types.rb
puppet-strings-2.4.0 lib/puppet-strings/markdown/data_types.rb
puppet-strings-2.3.1 lib/puppet-strings/markdown/data_types.rb
puppet-strings-2.3.0 lib/puppet-strings/markdown/data_types.rb