Class: Zwite::Liquid::Block

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/zwite/liquid/block.rb

Constant Summary collapse

Syntax =
/(\w+)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ Block

Returns a new instance of Block.



10
11
12
13
14
15
16
17
# File 'lib/zwite/liquid/block.rb', line 10

def initialize(tag_name, markup, tokens)
  if markup =~ Syntax
    @name = $1
  else
    raise SyntaxError.new("Syntax Error in 'block' - Valid syntax {% block [name] %}{% endblock %}")
  end
  super
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/zwite/liquid/block.rb', line 8

def name
  @name
end

Instance Method Details

#render(context) ⇒ Object



19
20
21
22
23
# File 'lib/zwite/liquid/block.rb', line 19

def render(context)
  context.stack do
    render_all(@nodelist, context)
  end
end