Sha256: 4f41e4eed195d2481d81e41fa732227c65c6d1f4d50f73e8cd48be29e8ec91d0

Contents?: true

Size: 834 Bytes

Versions: 9

Compression:

Stored size: 834 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

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