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 16
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 11
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 20
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 36
def item title, file_name
  "* [#{title}](#{ERB::Util.url_encode(file_name)})"
end
table_of_contents() click to toggle source
# File lib/pact/doc/markdown/index_renderer.rb, line 26
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 32
def title
  "### Pacts for #{consumer_name}"
end