class PactBroker::Api::Renderers::IntegrationsDotRenderer

Attributes

integrations[R]

Public Class Methods

call(integrations) click to toggle source
# File lib/pact_broker/api/renderers/integrations_dot_renderer.rb, line 9
def self.call(integrations)
  new(integrations).call
end
new(integrations) click to toggle source
# File lib/pact_broker/api/renderers/integrations_dot_renderer.rb, line 5
def initialize(integrations)
  @integrations = integrations
end

Public Instance Methods

call() click to toggle source
# File lib/pact_broker/api/renderers/integrations_dot_renderer.rb, line 13
        def call
          "digraph { ranksep=3; ratio=auto; overlap=false; node [  shape = plaintext, fontname = Helvetica ];
#{integrations_graph}
}
"
        end

Private Instance Methods

escape_name(name) click to toggle source
# File lib/pact_broker/api/renderers/integrations_dot_renderer.rb, line 30
def escape_name(name)
  name.tr(" ", "_")
end
integrations_graph() click to toggle source
# File lib/pact_broker/api/renderers/integrations_dot_renderer.rb, line 24
def integrations_graph
  integrations
    .collect{ | integration| "  #{escape_name(integration.consumer_name)} -> #{escape_name(integration.provider_name)}" }
    .join("\n")
end