class Graph::Vertex

Attributes

attachment[RW]
graph[R]
key[R]

Public Class Methods

new(key: nil, attachment: nil) click to toggle source
# File lib/graph/vertex.rb, line 7
def initialize(key: nil, attachment: nil)
  @key = key || (@@autoincrement_counter += 1)
  @attachment = attachment
end

Public Instance Methods

to_h() click to toggle source
# File lib/graph/vertex.rb, line 12
def to_h
  { edges: [], attachment: attachment.to_h }
end

Private Instance Methods

add_to(graph) click to toggle source
# File lib/graph/vertex.rb, line 18
def add_to(graph)
  @graph = graph
end