Class: Liquid::Ifchanged

Inherits:
Block show all
Defined in:
lib/liquid/tags/ifchanged.rb

Instance Attribute Summary

Attributes inherited from Tag

#line_number, #nodelist, #parse_context, #tag_name

Instance Method Summary collapse

Methods inherited from Block

#blank?, #block_delimiter, #block_name, #initialize, #nodelist, #parse, #unknown_tag

Methods inherited from Tag

#blank?, #initialize, #name, parse, #parse, #raw

Methods included from ParserSwitching

#parse_with_selected_parser

Constructor Details

This class inherits a constructor from Liquid::Block

Instance Method Details

#render(context) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/liquid/tags/ifchanged.rb', line 3

def render(context)
  context.stack do
    output = super

    if output != context.registers[:ifchanged]
      context.registers[:ifchanged] = output
      output
    else
      ''.freeze
    end
  end
end