Class: Grumlin::Vertex
- Inherits:
-
Object
- Object
- Grumlin::Vertex
- Defined in:
- lib/grumlin/vertex.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(label:, id:, properties: nil) ⇒ Vertex
constructor
A new instance of Vertex.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(label:, id:, properties: nil) ⇒ Vertex
Returns a new instance of Vertex.
6 7 8 9 10 |
# File 'lib/grumlin/vertex.rb', line 6 def initialize(label:, id:, properties: nil) @label = label @id = Grumlin::Typing.cast(id) @properties = properties&.transform_values { |v| Grumlin::Typing.cast(v) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/grumlin/vertex.rb', line 4 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/grumlin/vertex.rb', line 4 def label @label end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
4 5 6 |
# File 'lib/grumlin/vertex.rb', line 4 def properties @properties end |
Instance Method Details
#==(other) ⇒ Object
12 13 14 |
# File 'lib/grumlin/vertex.rb', line 12 def ==(other) self.class == other.class && @label == other.label && @id == other.id end |
#inspect ⇒ Object
16 17 18 |
# File 'lib/grumlin/vertex.rb', line 16 def inspect "v[#{@id}]" end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/grumlin/vertex.rb', line 20 def to_s inspect end |