Class: DirectedGraph::Vertex

Inherits:
Object
  • Object
show all
Defined in:
lib/directed_graph/vertex.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Vertex

Returns a new instance of Vertex.



8
9
10
11
# File 'lib/directed_graph/vertex.rb', line 8

def initialize(args)
  @name = args.fetch(:name)
  @data = args.fetch(:data, {})
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/directed_graph/vertex.rb', line 6

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/directed_graph/vertex.rb', line 5

def name
  @name
end