Class: SyntaxTree::YARV::SeaOfNodes::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/yarv/sea_of_nodes.rb

Overview

The edge of a graph represents either control flow or data flow.

Constant Summary collapse

TYPES =
%i[data control info].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, type, label) ⇒ Edge

Returns a new instance of Edge.



75
76
77
78
79
80
81
82
# File 'lib/syntax_tree/yarv/sea_of_nodes.rb', line 75

def initialize(from, to, type, label)
  raise unless TYPES.include?(type)

  @from = from
  @to = to
  @type = type
  @label = label
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



70
71
72
# File 'lib/syntax_tree/yarv/sea_of_nodes.rb', line 70

def from
  @from
end

#labelObject (readonly)

Returns the value of attribute label.



73
74
75
# File 'lib/syntax_tree/yarv/sea_of_nodes.rb', line 73

def label
  @label
end

#toObject (readonly)

Returns the value of attribute to.



71
72
73
# File 'lib/syntax_tree/yarv/sea_of_nodes.rb', line 71

def to
  @to
end

#typeObject (readonly)

Returns the value of attribute type.



72
73
74
# File 'lib/syntax_tree/yarv/sea_of_nodes.rb', line 72

def type
  @type
end