Sha256: 05627a15c8f4c6bc4d3e19d5e423a7571a3e0ad54ab672bba20bb1e1520dc79a

Contents?: true

Size: 818 Bytes

Versions: 142

Compression:

Stored size: 818 Bytes

Contents

module Pact
  module Doc
    module Markdown
      class IndexRenderer
        attr_reader :consumer_name
        attr_reader :docs # Hash of pact title => file_name

        def initialize consumer_name, docs
          @consumer_name = consumer_name
          @docs = docs
        end

        def self.call consumer_name, docs
          new(consumer_name, docs).call
        end

        def call
          title + "\n\n" + table_of_contents + "\n"
        end

        private

        def table_of_contents
          docs.collect do | title, file_name |
            item title, file_name
          end.join("\n")
        end

        def title
          "### Pacts for #{consumer_name}"
        end

        def item title, file_name
          "* [#{title}](#{file_name})"
        end

      end
    end
  end
end

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.111.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.109.1 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.109.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.108.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.107.1 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.107.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.107.0.beta.1 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.106.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.105.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.104.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.103.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.102.2 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.102.1 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.102.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.101.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.100.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.99.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.98.0 lib/pact/doc/markdown/index_renderer.rb
pact_broker-2.97.0 lib/pact/doc/markdown/index_renderer.rb