class PuppetReadmeGenerator::ClassAbstract

Public Class Methods

new(c) click to toggle source
# File lib/puppet_readme_generator.rb, line 112
def initialize(c)
  @c = c
end

Public Instance Methods

defaults() click to toggle source
# File lib/puppet_readme_generator.rb, line 175
def defaults
  @c['defaults']
end
examples() click to toggle source
# File lib/puppet_readme_generator.rb, line 124
def examples
  if @examples.nil?
    @examples = []
    begin
      @c['docstring']['tags'].each do |t|
        next unless t['tag_name'] == 'example'
        @examples << Example.new(t, self)
      end
    rescue NoMethodError
    end
  end
  @examples
end
markdown() click to toggle source
# File lib/puppet_readme_generator.rb, line 152
def markdown
  output = []
  output << "### `#{@c['name']}`\n"
  output << text
  output << ''

  if params.length > 0
    output << "#### Parameters\n"
    params.each do |p|
      output << p.markdown
    end
  end

  if examples.length > 0
    output << "#### Examples\n"
    examples.each do |e|
      output << e.markdown
    end
  end

  output.join("\n")
end
name() click to toggle source
# File lib/puppet_readme_generator.rb, line 116
def name
  @c['name']
end
params() click to toggle source
# File lib/puppet_readme_generator.rb, line 138
def params
  if @params.nil?
    @params = []
    begin
      @c['docstring']['tags'].each do |t|
        next unless t['tag_name'] == 'param'
        @params << Param.new(t, self)
      end
    rescue NoMethodError
    end
  end
  @params
end
text() click to toggle source
# File lib/puppet_readme_generator.rb, line 120
def text
  @c['docstring']['text']
end