Class: PuppetReadmeGenerator::ClassAbstract
- Inherits:
-
Object
- Object
- PuppetReadmeGenerator::ClassAbstract
- Defined in:
- lib/puppet_readme_generator.rb
Direct Known Subclasses
Instance Method Summary collapse
- #defaults ⇒ Object
- #examples ⇒ Object
-
#initialize(c) ⇒ ClassAbstract
constructor
A new instance of ClassAbstract.
- #markdown ⇒ Object
- #name ⇒ Object
- #params ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(c) ⇒ ClassAbstract
Returns a new instance of ClassAbstract.
112 113 114 |
# File 'lib/puppet_readme_generator.rb', line 112 def initialize(c) @c = c end |
Instance Method Details
#defaults ⇒ Object
175 176 177 |
# File 'lib/puppet_readme_generator.rb', line 175 def defaults @c['defaults'] end |
#examples ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# 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 ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# 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 ⇒ Object
116 117 118 |
# File 'lib/puppet_readme_generator.rb', line 116 def name @c['name'] end |
#params ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# 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 ⇒ Object
120 121 122 |
# File 'lib/puppet_readme_generator.rb', line 120 def text @c['docstring']['text'] end |