Class: Liquid::Ifchanged

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

Constant Summary

Constants inherited from Block

Block::MAX_DEPTH

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, #raise_tag_never_closed, raise_unknown_tag, #render, #unknown_tag

Methods inherited from Tag

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

Methods included from ParserSwitching

#parse_with_selected_parser, #strict_parse_with_error_mode_fallback

Constructor Details

This class inherits a constructor from Liquid::Block

Instance Method Details

#render_to_output_buffer(context, output) ⇒ Object



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

def render_to_output_buffer(context, output)
  block_output = +''
  super(context, block_output)

  if block_output != context.registers[:ifchanged]
    context.registers[:ifchanged] = block_output
    output << block_output
  end

  output
end