Method: Puppet::Graph::SimpleGraph#initialize_from_hash

Defined in:
lib/puppet/graph/simple_graph.rb

#initialize_from_hash(hash) ⇒ Object



500
501
502
503
504
505
506
507
508
509
510
# File 'lib/puppet/graph/simple_graph.rb', line 500

def initialize_from_hash(hash)
  initialize
  vertices = hash['vertices']
  edges = hash['edges']
  if vertices.is_a?(Hash)
    # Support old (2.6) format
    vertices = vertices.keys
  end
  vertices.each { |v| add_vertex(v) } unless vertices.nil?
  edges.each { |e| add_edge(e) } unless edges.nil?
end