Class: Liquid::Increment

### Home Classes Methods

### In Files

- lib/liquid/tags/increment.rb

### Parent

Liquid::Tag

### Methods

- ::new
- #render

### Class/Module Index

Quicksearch

- Liquid
- Liquid::ArgumentError
- Liquid::Assign
- Liquid::BlankFileSystem
- Liquid::Block
- Liquid::Break
- Liquid::BreakInterrupt
- Liquid::Capture
- Liquid::Case
- Liquid::Comment
- Liquid::Context
- Liquid::ContextError
- Liquid::Continue
- Liquid::ContinueInterrupt
- Liquid::Cycle
- Liquid::Decrement
- Liquid::Document
- Liquid::Drop
- Liquid::ElseCondition
- Liquid::Error
- Liquid::FileSystemError
- Liquid::FilterNotFound
- Liquid::For
- Liquid::If
- Liquid::Ifchanged
- Liquid::Include
- Liquid::Increment
- Liquid::Interrupt
- Liquid::LocalFileSystem
- Liquid::MemoryError
- Liquid::Raw
- Liquid::StackLevelError
- Liquid::StandardError
- Liquid::StandardFilters
- Liquid::SyntaxError
- Liquid::TableRow
- Liquid::Tag
- Liquid::Template
- Liquid::Unless
- Liquid::Utils
- Liquid::Variable
- FalseClass
- LiquidView
- Module
- NilClass
- TrueClass

No matching classes.

# Liquid::Increment

    Hello: {% increment variable %}

gives you:

    Hello: 0
    Hello: 1
    Hello: 2

### Public Class Methods

new(tag_name, markup, tokens) click to toggle source

    # File lib/liquid/tags/increment.rb, line 19
    def initialize(tag_name, markup, tokens)
      @variable = markup.strip

      super
    end

### Public Instance Methods

render(context) click to toggle source

    # 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.