class Pact::Doc::Markdown::ConsumerContractRenderer

Attributes

consumer_contract[R]

Public Class Methods

call(consumer_contract) click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 13
def self.call consumer_contract
  new(consumer_contract).call
end
new(consumer_contract) click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 9
def initialize consumer_contract
  @consumer_contract = consumer_contract
end

Public Instance Methods

call() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 17
def call
  title + summaries_title + summaries.join + interactions_title + full_interactions.join
end

Private Instance Methods

consumer_name() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 53
def consumer_name
  markdown_escape consumer_contract.consumer.name
end
full_interactions() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 45
def full_interactions
  interaction_renderers.collect(&:render_full_interaction)
end
interaction_renderers() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 29
def interaction_renderers
  @interaction_renderers ||= sorted_interactions.collect{|interaction| InteractionRenderer.new interaction, @consumer_contract}
end
interactions_title() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 37
def interactions_title
  "#### Interactions\n\n"
end
markdown_escape(string) click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 61
def markdown_escape string
  string.gsub('*','\*').gsub('_','\_')
end
provider_name() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 57
def provider_name
  markdown_escape consumer_contract.provider.name
end
sorted_interactions() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 49
def sorted_interactions
  SortInteractions.call(consumer_contract.interactions)
end
summaries() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 41
def summaries
  interaction_renderers.collect(&:render_summary)
end
summaries_title() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 33
def summaries_title
  "#### Requests from #{consumer_name} to #{provider_name}\n\n"
end
title() click to toggle source
# File lib/pact/doc/markdown/consumer_contract_renderer.rb, line 25
def title
  "### A pact between #{consumer_name} and #{provider_name}\n\n"
end