class Pact::Doc::Markdown::IndexRenderer

Attributes

consumer_name[R]
docs[R]

Public Class Methods

call(consumer_name, docs) click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 13
def self.call consumer_name, docs
  new(consumer_name, docs).call
end
new(consumer_name, docs) click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 8
def initialize consumer_name, docs
  @consumer_name = consumer_name
  @docs = docs
end

Public Instance Methods

call() click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 17
def call
  title + "\n\n" + table_of_contents + "\n"
end

Private Instance Methods

item(title, file_name) click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 33
def item title, file_name
  "* [#{title}](#{file_name})"
end
table_of_contents() click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 23
def table_of_contents
  docs.collect do | title, file_name |
    item title, file_name
  end.join("\n")
end
title() click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 29
def title
  "### Pacts for #{consumer_name}"
end