Class: PuppetReadmeGenerator::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_readme_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(t, p) ⇒ Param

Returns a new instance of Param.



187
188
189
190
# File 'lib/puppet_readme_generator.rb', line 187

def initialize(t, p)
  @t = t
  @p = p
end

Instance Method Details

#markdownObject



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/puppet_readme_generator.rb', line 192

def markdown
  output = []
  output << "##### `#{@t['name']}`\n"

  if not @t['text'].nil? and @t['text'].length > 0
    output << "* #{@t['text']}"
  end

  ptype = @t['types']
  if not ptype.nil? and ptype.length > 1
    output << "* Type: `#{ptype}`"
  elsif not ptype.nil? and ptype.length == 1
    output << "* Type: `#{ptype.first}`"
  end
  default = @p.defaults[@t['name']]
  output << "* Default: `#{default}`" unless default.nil?
  output << ''
  output.join("\n")
end