Sha256: 279e9dda90e7d1880f3e006f714192175d885ff44492caa4310dcc758dfbc822

Contents?: true

Size: 483 Bytes

Versions: 5

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

module Liquid
  # Break tag to be used to break out of a for loop.
  #
  # == Basic Usage:
  #    {% for item in collection %}
  #      {% if item.condition %}
  #        {% break %}
  #      {% endif %}
  #    {% endfor %}
  #
  class Break < Tag
    INTERRUPT = BreakInterrupt.new.freeze

    def render_to_output_buffer(context, output)
      context.push_interrupt(INTERRUPT)
      output
    end
  end

  Template.register_tag('break', Break)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
liquid-5.3.0 lib/liquid/tags/break.rb
liquid-5.2.0 lib/liquid/tags/break.rb
liquid-5.1.0 lib/liquid/tags/break.rb
liquid-5.0.1 lib/liquid/tags/break.rb
liquid-5.0.0 lib/liquid/tags/break.rb