Class: Ruty::Datastructure::NodeList

Inherits:
Node
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ruty/datastructure.rb

Overview

node list class. can store multiple nodes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial = nil, parser = nil) ⇒ NodeList

Returns a new instance of NodeList.



26
27
28
29
# File 'lib/ruty/datastructure.rb', line 26

def initialize initial=nil, parser=nil
  @nodes = initial || []
  @parser = parser
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



24
25
26
# File 'lib/ruty/datastructure.rb', line 24

def parser
  @parser
end

Instance Method Details

#<<(node) ⇒ Object



31
32
33
# File 'lib/ruty/datastructure.rb', line 31

def << node
  @nodes << node
end

#each(&block) ⇒ Object



35
36
37
# File 'lib/ruty/datastructure.rb', line 35

def each &block
  @nodes.each(&block)
end

#render_node(context, stream) ⇒ Object



39
40
41
42
43
44
# File 'lib/ruty/datastructure.rb', line 39

def render_node context, stream
  @nodes.each do |node|
    node.render_node(context, stream)
  end
  nil
end