Class: Tina4::GraphNode
- Inherits:
-
Object
- Object
- Tina4::GraphNode
- Defined in:
- lib/tina4/graph.rb
Overview
An engine-neutral vertex: id, labels, properties.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
-
#initialize(id:, labels: nil, properties: nil) ⇒ GraphNode
constructor
A new instance of GraphNode.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(id:, labels: nil, properties: nil) ⇒ GraphNode
Returns a new instance of GraphNode.
126 127 128 129 130 |
# File 'lib/tina4/graph.rb', line 126 def initialize(id:, labels: nil, properties: nil) @id = id @labels = Array(labels) @properties = properties || {} end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
124 125 126 |
# File 'lib/tina4/graph.rb', line 124 def id @id end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
124 125 126 |
# File 'lib/tina4/graph.rb', line 124 def labels @labels end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
124 125 126 |
# File 'lib/tina4/graph.rb', line 124 def properties @properties end |
Instance Method Details
#inspect ⇒ Object
136 137 138 |
# File 'lib/tina4/graph.rb', line 136 def inspect "#<Tina4::GraphNode id=#{@id.inspect} labels=#{@labels.inspect}>" end |
#to_h ⇒ Object
132 133 134 |
# File 'lib/tina4/graph.rb', line 132 def to_h { "id" => @id, "labels" => @labels, "properties" => @properties } end |