Class: Lrama::Counterexamples::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/counterexamples/node.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elem, next_node) ⇒ Node

Returns a new instance of Node.



24
25
26
27
# File 'lib/lrama/counterexamples/node.rb', line 24

def initialize(elem, next_node)
  @elem = elem
  @next_node = next_node
end

Instance Attribute Details

#elemObject (readonly)

: E



8
9
10
# File 'lib/lrama/counterexamples/node.rb', line 8

def elem
  @elem
end

#next_nodeObject (readonly)

: Node?



9
10
11
# File 'lib/lrama/counterexamples/node.rb', line 9

def next_node
  @next_node
end

Class Method Details

.to_a(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/lrama/counterexamples/node.rb', line 12

def self.to_a(node)
  a = [] # steep:ignore UnannotatedEmptyCollection

  while (node)
    a << node.elem
    node = node.next_node
  end

  a
end