Class: Specific::Renderer::Markdown
- Inherits:
-
Object
- Object
- Specific::Renderer::Markdown
- Includes:
- Base
- Defined in:
- lib/specific/renderer/markdown.rb
Instance Method Summary collapse
-
#initialize(spec) ⇒ Markdown
constructor
A new instance of Markdown.
- #render ⇒ Object
Methods included from Base
Constructor Details
#initialize(spec) ⇒ Markdown
Returns a new instance of Markdown.
8 9 10 |
# File 'lib/specific/renderer/markdown.rb', line 8 def initialize(spec) @spec = spec end |
Instance Method Details
#render ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/specific/renderer/markdown.rb', line 12 def render out = "# Project Specific\n\n" grouped_features = @spec.features.group_by(&:group) grouped_features.each do |group, features| group_title = "## Features '#{group.name}'" out << group_title + "\n\n" features.each do |feature| out << "* [#{feature_to_s feature}](#feature-#{feature.id})\n" end out << "\n" features.sort_by(&:id).each do |feature| out << [ "### #{feature_to_s feature}", "<a href=\"feature-#{feature.id}\"></a>", "\n" ].join("\n") out << feature.description.join(" \n") + "\n\n" feature.scenarios.each do |scenario| out << "#### Scenario: #{scenario.name}\n" scenario.steps.each do |step| out << "* #{step.keyword} #{step.text}\n" end out << "\n" end out << "\n" end end out end |