Class: Tina4::GraphEdge
- Inherits:
-
Object
- Object
- Tina4::GraphEdge
- Defined in:
- lib/tina4/graph.rb
Overview
An engine-neutral edge: id, type, from/to node ids, properties.
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id:, type:, from:, to:, properties: nil) ⇒ GraphEdge
constructor
A new instance of GraphEdge.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(id:, type:, from:, to:, properties: nil) ⇒ GraphEdge
Returns a new instance of GraphEdge.
145 146 147 148 149 150 151 |
# File 'lib/tina4/graph.rb', line 145 def initialize(id:, type:, from:, to:, properties: nil) @id = id @type = type @from = from @to = to @properties = properties || {} end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
143 144 145 |
# File 'lib/tina4/graph.rb', line 143 def from @from end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
143 144 145 |
# File 'lib/tina4/graph.rb', line 143 def id @id end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
143 144 145 |
# File 'lib/tina4/graph.rb', line 143 def properties @properties end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
143 144 145 |
# File 'lib/tina4/graph.rb', line 143 def to @to end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
143 144 145 |
# File 'lib/tina4/graph.rb', line 143 def type @type end |
Instance Method Details
#inspect ⇒ Object
158 159 160 161 |
# File 'lib/tina4/graph.rb', line 158 def inspect "#<Tina4::GraphEdge id=#{@id.inspect} type=#{@type.inspect} " \ "#{@from.inspect}->#{@to.inspect}>" end |
#to_h ⇒ Object
153 154 155 156 |
# File 'lib/tina4/graph.rb', line 153 def to_h { "id" => @id, "type" => @type, "from" => @from, "to" => @to, "properties" => @properties } end |