Sha256: 187f4a2a2b894fe523a02d64d976ebd15bd9cd47a42cdbf7de46e2b56b3b9d0c

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

require 'molinillo'

module PuppetfileResolver
  class ResolutionResult
    attr_reader :dependency_graph, :puppetfile_document

    def initialize(dependency_graph, puppetfile_document)
      raise "Expected Molinillo::DependencyGraph but got #{dependency_graph.class}" unless dependency_graph.is_a?(Molinillo::DependencyGraph)
      @dependency_graph = dependency_graph
      @puppetfile_document = puppetfile_document
    end

    def specifications
      # Note - Later rubies have `.transform_values` however we support old Ruby versions
      result = {}
      @dependency_graph.vertices.each { |key, vertex| result[key] = vertex.payload }
      result
    end

    def to_dot
      @dependency_graph.to_dot
    end

    def validation_errors
      @puppetfile_document.resolution_validation_errors(self)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppetfile-resolver-0.6.3 lib/puppetfile-resolver/resolution_result.rb
puppetfile-resolver-0.6.2 lib/puppetfile-resolver/resolution_result.rb
puppetfile-resolver-0.6.1 lib/puppetfile-resolver/resolution_result.rb
puppetfile-resolver-0.6.0 lib/puppetfile-resolver/resolution_result.rb
puppetfile-resolver-0.5.0 lib/puppetfile-resolver/resolution_result.rb
puppetfile-resolver-0.4.0 lib/puppetfile-resolver/resolution_result.rb