Class: H2o::Tags::Extends
Constant Summary collapse
- Syntax =
/\"(.*?)\"|\'(.*?)\'/
Instance Method Summary collapse
-
#initialize(parser, argstring) ⇒ Extends
constructor
A new instance of Extends.
- #render(context, stream) ⇒ Object
Constructor Details
#initialize(parser, argstring) ⇒ Extends
Returns a new instance of Extends.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/h2o/tags/extends.rb', line 6 def initialize parser, argstring unless parser.first? raise SyntaxError, "extend tag needs to be at the beginning of the document" end # parser the entire subtemplate parser.parse() # load the parent template into nodelist @nodelist = Template.load(argstring[1...-1], parser.env) blocks = @nodelist.parser.storage[:blocks] || {} (parser.storage[:blocks] || []).each do |name, block| if blocks.include? name blocks[name].add_layer(block) block.parent = blocks[name] end end end |
Instance Method Details
#render(context, stream) ⇒ Object
26 27 28 |
# File 'lib/h2o/tags/extends.rb', line 26 def render context, stream @nodelist.render(context, stream) end |