Class: PolySSH::NodeList

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Visitable
Defined in:
lib/polyssh/node.rb

Instance Method Summary collapse

Methods included from Visitable

#accept

Constructor Details

#initializeNodeList

Returns a new instance of NodeList.



16
17
18
19
# File 'lib/polyssh/node.rb', line 16

def initialize
  @head = nil
  @tail = nil
end

Instance Method Details

#<<(node) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/polyssh/node.rb', line 21

def <<(node)
  if @head.nil? then
    @head = node
    @tail = node
  else
    @tail.next = node
    @tail = node
  end
  self
end

#eachObject



8
9
10
11
12
13
14
# File 'lib/polyssh/node.rb', line 8

def each 
  ptr = @head 
  while not ptr.nil? do
    yield ptr 
    ptr = ptr.next
  end
end