Sha256: 65643cdc16fd035f457a4e111abab0904eba9aa510e04eb262e2f7d1143bf23a

Contents?: true

Size: 798 Bytes

Versions: 21

Compression:

Stored size: 798 Bytes

Contents

module PactBroker
  module Api
    module Renderers
      class IntegrationsDotRenderer
        def initialize(integrations)
          @integrations = integrations
        end

        def self.call(integrations)
          new(integrations).call
        end

        def call
          "digraph { ranksep=3; ratio=auto; overlap=false; node [  shape = plaintext, fontname = Helvetica ];
#{integrations_graph}
}
"
        end

        private

        attr_reader :integrations

        def integrations_graph
          integrations
            .collect{ | integration| "  #{escape_name(integration.consumer_name)} -> #{escape_name(integration.provider_name)}" }
            .join("\n")
        end

        def escape_name(name)
          name.gsub(" ", "_")
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.39.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.38.1 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.38.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.37.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.36.1 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.36.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.35.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.34.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.33.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.32.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.31.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.30.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.29.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.6 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.5 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.4 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.3 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.2 lib/pact_broker/api/renderers/integrations_dot_renderer.rb
pact_broker-2.27.0 lib/pact_broker/api/renderers/integrations_dot_renderer.rb