class Pact::Doc::Markdown::IndexRenderer
Attributes
Public Class Methods
Source
# File lib/pact/doc/markdown/index_renderer.rb, line 16 def self.call consumer_name, docs new(consumer_name, docs).call end
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
Source
# File lib/pact/doc/markdown/index_renderer.rb, line 20 def call title + "\n\n" + table_of_contents + "\n" end
Private Instance Methods
Source
# File lib/pact/doc/markdown/index_renderer.rb, line 36 def item title, file_name "* [#{title}](#{ERB::Util.url_encode(file_name)})" end
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
Source
# File lib/pact/doc/markdown/index_renderer.rb, line 32 def title "### Pacts for #{consumer_name}" end