Class: H2o::Nodelist
Overview
Nodelist
Instance Attribute Summary collapse
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
- #<<(node) ⇒ Object
-
#initialize(parser, position = 0) ⇒ Nodelist
constructor
A new instance of Nodelist.
- #length ⇒ Object
- #render(context = {}, stream = false) ⇒ Object
Constructor Details
#initialize(parser, position = 0) ⇒ Nodelist
Returns a new instance of Nodelist.
17 18 19 20 |
# File 'lib/h2o/nodes.rb', line 17 def initialize(parser, position = 0) @parser = parser @stack = [] end |
Instance Attribute Details
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
15 16 17 |
# File 'lib/h2o/nodes.rb', line 15 def parser @parser end |
Instance Method Details
#<<(node) ⇒ Object
33 34 35 |
# File 'lib/h2o/nodes.rb', line 33 def <<(node) @stack << node end |
#length ⇒ Object
37 38 39 |
# File 'lib/h2o/nodes.rb', line 37 def length @stack.length end |
#render(context = {}, stream = false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/h2o/nodes.rb', line 22 def render(context = {}, stream = false) stream = [] unless stream context = Context.new(context) if context.is_a? Hash @stack.each do |node| node.render(context, stream) end stream.join end |