Class: Tina4::GraphEdge

Inherits:
Object
  • Object
show all
Defined in:
lib/tina4/graph.rb

Overview

An engine-neutral edge: id, type, from/to node ids, properties.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject (readonly)

Returns the value of attribute from.



143
144
145
# File 'lib/tina4/graph.rb', line 143

def from
  @from
end

#idObject (readonly)

Returns the value of attribute id.



143
144
145
# File 'lib/tina4/graph.rb', line 143

def id
  @id
end

#propertiesObject (readonly)

Returns the value of attribute properties.



143
144
145
# File 'lib/tina4/graph.rb', line 143

def properties
  @properties
end

#toObject (readonly)

Returns the value of attribute to.



143
144
145
# File 'lib/tina4/graph.rb', line 143

def to
  @to
end

#typeObject (readonly)

Returns the value of attribute type.



143
144
145
# File 'lib/tina4/graph.rb', line 143

def type
  @type
end

Instance Method Details

#inspectObject



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_hObject



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