Class: Grumlin::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/grumlin/edge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, id:, inVLabel:, outVLabel:, inV:, outV:) ⇒ Edge

Returns a new instance of Edge.



6
7
8
9
10
11
12
13
# File 'lib/grumlin/edge.rb', line 6

def initialize(label:, id:, inVLabel:, outVLabel:, inV:, outV:)
  @label = label
  @id = Grumlin::Typing.cast(id)
  @inVLabel = inVLabel
  @outVLabel = outVLabel
  @inV = Grumlin::Typing.cast(inV)
  @outV = Grumlin::Typing.cast(outV)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def id
  @id
end

#inVObject (readonly)

Returns the value of attribute inV.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def inV
  @inV
end

#inVLabelObject (readonly)

Returns the value of attribute inVLabel.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def inVLabel
  @inVLabel
end

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def label
  @label
end

#outVObject (readonly)

Returns the value of attribute outV.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def outV
  @outV
end

#outVLabelObject (readonly)

Returns the value of attribute outVLabel.



4
5
6
# File 'lib/grumlin/edge.rb', line 4

def outVLabel
  @outVLabel
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/grumlin/edge.rb', line 15

def ==(other)
  self.class == other.class && @label == other.label && @id == other.id
end

#inspectObject



19
20
21
# File 'lib/grumlin/edge.rb', line 19

def inspect
  "e[#{@id}][#{@outV}-#{@label}->#{@inV}]"
end

#to_sObject



23
24
25
# File 'lib/grumlin/edge.rb', line 23

def to_s
  inspect
end