Class: Liquid2::DecrementTag
- Defined in:
- lib/liquid2/nodes/tags/decrement.rb
Overview
The standard decrement tag.
Instance Attribute Summary
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token, name) ⇒ DecrementTag
constructor
A new instance of DecrementTag.
- #render(context, buffer) ⇒ Object
- #template_scope ⇒ Object
Methods inherited from Tag
Methods inherited from Node
#block_scope, #children, #expressions, #partial_scope, #render_with_disabled_tag_check
Constructor Details
#initialize(token, name) ⇒ DecrementTag
Returns a new instance of DecrementTag.
18 19 20 21 |
# File 'lib/liquid2/nodes/tags/decrement.rb', line 18 def initialize(token, name) super(token) @name = name end |
Class Method Details
.parse(token, parser) ⇒ DecrementTag
10 11 12 13 14 15 |
# File 'lib/liquid2/nodes/tags/decrement.rb', line 10 def self.parse(token, parser) name = parser.parse_identifier(trailing_question: false) parser.carry_whitespace_control parser.eat(:token_tag_end) new(token, name) end |
Instance Method Details
#render(context, buffer) ⇒ Object
23 24 25 |
# File 'lib/liquid2/nodes/tags/decrement.rb', line 23 def render(context, buffer) buffer << context.decrement(@name.name).to_s end |
#template_scope ⇒ Object
27 |
# File 'lib/liquid2/nodes/tags/decrement.rb', line 27 def template_scope = [@name] |