Class: Liquid::Ifchanged

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

Constant Summary

Constants inherited from Block

Block::ContentOfVariable, Block::FullToken, Block::IsTag, Block::IsVariable

Instance Attribute Summary

Attributes inherited from Tag

#context, #nodelist

Instance Method Summary collapse

Methods inherited from Block

#block_delimiter, #block_name, #create_variable, #end_tag, #parse, #unknown_tag

Methods inherited from Tag

#initialize, #name, #parse

Constructor Details

This class inherits a constructor from Liquid::Tag

Instance Method Details

#render(context) ⇒ Object



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

def render(context)
  context.stack do

    output = render_all(@nodelist, context)

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