Sha256: 8ba30515200a87372ec75d64b68be468dd6499bd6acc5f7c081db03e95e02c72
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require 'puppet-strings/markdown/base' module PuppetStrings::Markdown # Generates Markdown for a Puppet Resource Type. class ResourceType < Base group_name 'Resource types' yard_types [:puppet_type] def initialize(registry) @template = 'resource_type.erb' super(registry, 'type') end def render super(@template) end def properties return nil unless @registry[:properties] @registry[:properties].sort_by { |p| p[:name] } end def checks return nil unless @registry[:checks] @registry[:checks].sort_by { |p| p[:name] } end # "checks" (such as "onlyif" or "creates") are another type of property def properties_and_checks return nil if properties.nil? && checks.nil? ((properties || []) + (checks || [])).sort_by { |p| p[:name] }.map do |prop| prop[:link] = clean_link("$#{name}::#{prop[:name]}") prop end end def parameters return nil unless @registry[:parameters] @registry[:parameters].sort_by { |p| p[:name] }.map do |param| param[:link] = clean_link("$#{name}::#{param[:name]}") param end end def regex_in_data_type?(data_type) m = data_type.match(%r{\w+\[/.*/\]}) m unless m.nil? || m.length.zero? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-strings-3.0.1 | lib/puppet-strings/markdown/resource_type.rb |
puppet-strings-3.0.0 | lib/puppet-strings/markdown/resource_type.rb |