Sha256: 78b35615187dbc7c1b1156b07c6ab7469c0e1410bfb01cfa69c780d240e8f479

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

# frozen_string_literal: true

require 'puppet-strings/markdown/base'

module PuppetStrings::Markdown
  # This class encapsualtes ruby data types and puppet type aliases
  class DataType < Base
    attr_reader :alias_of
    attr_reader :functions

    group_name 'Data types'
    yard_types [:puppet_data_type, :puppet_data_type_alias]

    def initialize(registry)
      @template = 'data_type.erb'
      super(registry, 'data type')
      @alias_of = registry[:alias_of] unless registry[:alias_of].nil?
      @functions = @registry[:functions].nil? ? nil : @registry[:functions].map { |func| DataType::Function.new(func) }
    end

    def render
      super(@template)
    end
  end

  # Generates Markdown for a Puppet Function.
  class DataType::Function < Base
    def initialize(registry)
      super(registry, 'data_type_function')
    end

    def render
      super('data_type_function.erb')
    end

    def signature
      @registry[:signature]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-strings-3.0.1 lib/puppet-strings/markdown/data_type.rb
puppet-strings-3.0.0 lib/puppet-strings/markdown/data_type.rb