Sha256: 1d2bd3fed93852dad2716afd079f56464e294b2366b4e94752a54be3e75387ba

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 Bytes

Contents

class Graph::Vertex
  attr_reader :key, :graph
  attr_accessor :attachment

  @@autoincrement_counter = 0

  def initialize(key: nil, attachment: nil)
    @key = key || (@@autoincrement_counter += 1)
    @attachment = attachment
  end

  def to_h
    { edges: [], attachment: attachment.to_h }
  end

  private

  def add_to(graph)
    @graph = graph
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graph-rb-0.1.1 lib/graph/vertex.rb