Sha256: cecbe2b175a1224e7a6137a56e778b723472247aebaecb0b576881f2a105f4bf

Contents?: true

Size: 865 Bytes

Versions: 4

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

require_relative 'function'

module PuppetStrings::Markdown
  module Functions

    # @return [Array] list of functions
    def self.in_functions
      arr = YARD::Registry.all(:puppet_function).sort_by!(&:name).map!(&:to_hash)
      arr.map! { |a| PuppetStrings::Markdown::Function.new(a) }
    end

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

    def self.render
      final = in_functions.length > 0 ? "## Functions\n\n" : ""
      in_functions.each do |func|
        final += func.render unless func.private?
      end
      final
    end

    def self.toc_info
      final = ["Functions"]

      in_functions.each do |func|
        final.push(func.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/functions.rb
puppet-strings-2.8.0 lib/puppet-strings/markdown/functions.rb
puppet-strings-2.7.0 lib/puppet-strings/markdown/functions.rb
puppet-strings-2.6.0 lib/puppet-strings/markdown/functions.rb