Parent

Methods

Liquid::Decrement

Hello: {% decrement variable %}

gives you:

Hello: -1
Hello: -2
Hello: -3

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
# File lib/liquid/tags/decrement.rb, line 22
def initialize(tag_name, markup, tokens)
  @variable = markup.strip

  super
end

Public Instance Methods

render(context) click to toggle source
# File lib/liquid/tags/decrement.rb, line 28
def render(context)
  value = context.environments.first[@variable] ||= 0
  value = value - 1
  context.environments.first[@variable] = value
  value.to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.