class PuppetStrings::Markdown::ResourceType

Generates Markdown for a Puppet Resource Type.

Public Class Methods

new(registry) click to toggle source
Calls superclass method PuppetStrings::Markdown::Base::new
# File lib/puppet-strings/markdown/resource_type.rb, line 11
def initialize(registry)
  @template = 'resource_type.erb'
  super(registry, 'type')
end

Public Instance Methods

checks() click to toggle source
# File lib/puppet-strings/markdown/resource_type.rb, line 26
def checks
  return nil unless @registry[:checks]

  @registry[:checks].sort_by { |p| p[:name] }
end
parameters() click to toggle source
# File lib/puppet-strings/markdown/resource_type.rb, line 42
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
properties() click to toggle source
# File lib/puppet-strings/markdown/resource_type.rb, line 20
def properties
  return nil unless @registry[:properties]

  @registry[:properties].sort_by { |p| p[:name] }
end
properties_and_checks() click to toggle source

“checks” (such as “onlyif” or “creates”) are another type of property

# File lib/puppet-strings/markdown/resource_type.rb, line 33
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
regex_in_data_type?(data_type) click to toggle source
# File lib/puppet-strings/markdown/resource_type.rb, line 51
def regex_in_data_type?(data_type)
  m = data_type.match(%r{\w+\[/.*/\]})
  m unless m.nil? || m.to_a.empty?
end
render() click to toggle source
Calls superclass method PuppetStrings::Markdown::Base#render
# File lib/puppet-strings/markdown/resource_type.rb, line 16
def render
  super(@template)
end