Sha256: 820db09277e7d0b985bbbd877d40401b5c56cd85e493b6492355c01dfa3e1082

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

module JobSpec
  class RenderAsMarkdown
    attr_reader :role

    def initialize(role)
      @role = role
    end

    def render
      markdown = []
      markdown << "# #{role.name}"
      markdown << role.description unless role.description.nil?

      role.expectations.map(&:values).each do |(expectation, description)|
        markdown << "## #{expectation[0].upcase}#{expectation[1..expectation.length]}"
        markdown << description unless description.nil?
      end

      markdown.join("\n\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
job_spec-0.2.4 lib/job_spec/render_as_markdown.rb
job_spec-0.2.3 lib/job_spec/render_as_markdown.rb
job_spec-0.2.2 lib/job_spec/render_as_markdown.rb