Sha256: d2b9057bf2816e7833dfbfa13ed076a823339e95c8d545a839b356687615ae5f

Contents?: true

Size: 554 Bytes

Versions: 3

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module CobraCommander
  class CLI
    module Output
      # Generates graphs of components
      module DotGraph
        def self.generate(components, output)
          output << "digraph G {\n"
          [*components, *components.flat_map(&:deep_dependencies)].uniq.each do |comp|
            output << "\t#{comp.name};\n"
            comp.dependencies.each do |dep|
              output << "\t#{comp.name} -> #{dep.name};\n"
            end
          end
          output << "}\n"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cobra_commander-1.1.0 lib/cobra_commander/cli/output/dot_graph.rb
cobra_commander-1.0.1 lib/cobra_commander/cli/output/dot_graph.rb
cobra_commander-1.0.0 lib/cobra_commander/cli/output/dot_graph.rb