Class: Liquid2::UnlessTag
- Defined in:
- lib/liquid2/nodes/tags/unless.rb
Overview
The standard unless tag.
Constant Summary collapse
- END_TAG =
"endunless"- END_BLOCK =
Set["else", "elsif", "endunless"].freeze
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
Methods inherited from IfTag
#children, #expressions, #initialize, parse, parse_elsif
Methods inherited from Tag
Methods inherited from Node
#block_scope, #children, #expressions, #initialize, #partial_scope, #render_with_disabled_tag_check, #template_scope
Constructor Details
This class inherits a constructor from Liquid2::IfTag
Instance Method Details
#render(context, buffer) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/liquid2/nodes/tags/unless.rb', line 11 def render(context, buffer) return @block.render(context, buffer) unless @expression.evaluate(context) @alternatives.each do |alt| return alt.block.render(context, buffer) if alt.expression.evaluate(context) end return (@default || raise).render(context, buffer) if @default 0 end |