Tag
Hello: {% increment variable %}
gives you:
Hello: 0 Hello: 1 Hello: 2
# File lib/liquid/tags/increment.rb, line 19 def initialize(tag_name, markup, tokens) @variable = markup.strip super end
# File lib/liquid/tags/increment.rb, line 25 def render(context) value = context.environments.first[@variable] ||= 0 context.environments.first[@variable] = value + 1 value.to_s end
[Validate]
Generated with the Darkfish Rdoc Generator 2.