class Pact::Doc::Markdown::InteractionRenderer
def initialize interaction, pact
def initialize interaction, pact @interaction = InteractionViewModel.new(interaction, pact) end
def render template_file
def render template_file ERB.new(template_string(template_file)).result(binding) end
def render_full_interaction
def render_full_interaction render('/interaction.erb') end
def render_summary
def render_summary suffix = interaction.has_provider_state? ? " given #{interaction.provider_state}" : "" "* [#{interaction.description(true)}](##{interaction.id})#{suffix}\n\n" end
def template_contents(template_file)
def template_contents(template_file) File.dirname(__FILE__) + template_file end
def template_string(template_file)
script encoding because it will joined to strings which are produced by
can read as UTF-8. But rendered strings must have same encoding as
The template file is written with only ASCII range characters, so we
def template_string(template_file) File.read(template_contents(template_file), external_encoding: Encoding::UTF_8).force_encoding(__ENCODING__) end