class PuppetStrings::Markdown::Function

Generates Markdown for a Puppet Function.

Attributes

signatures[R]

Public Class Methods

new(registry) click to toggle source
Calls superclass method PuppetStrings::Markdown::Base::new
# File lib/puppet-strings/markdown/function.rb, line 13
def initialize(registry)
  @template = 'function.erb'
  super(registry, 'function')
  @signatures = []
  registry[:signatures].each do |sig|
    @signatures.push(Signature.new(sig))
  end
end

Public Instance Methods

error_text(text) click to toggle source
# File lib/puppet-strings/markdown/function.rb, line 43
def error_text(text)
  text.split.drop(1).join(' ').to_s
end
error_type(type) click to toggle source
# File lib/puppet-strings/markdown/function.rb, line 39
def error_type(type)
  "`#{type.split[0]}`"
end
render() click to toggle source
Calls superclass method PuppetStrings::Markdown::Base#render
# File lib/puppet-strings/markdown/function.rb, line 22
def render
  super(@template)
end
type() click to toggle source
# File lib/puppet-strings/markdown/function.rb, line 26
def type
  t = @registry[:type]
  if t.include?('ruby4x')
    'Ruby 4.x API'
  elsif t.include?('ruby3')
    'Ruby 3.x API'
  elsif t.include?('ruby')
    'Ruby'
  else
    'Puppet Language'
  end
end