class Liquid::Capture

@liquid_public_docs @liquid_type tag @liquid_category variable @liquid_name capture @liquid_summary

Creates a new variable with a string value.

@liquid_description

You can create complex strings with Liquid logic and variables.

@liquid_syntax

{% capture variable %}
  value
{% endcapture %}

@liquid_syntax_keyword variable The name of the variable being created. @liquid_syntax_keyword value The value you want to assign to the variable.

Constants

Syntax

Public Class Methods

new(tag_name, markup, options) click to toggle source
Calls superclass method Liquid::Block::new
# File lib/liquid/tags/capture.rb, line 21
def initialize(tag_name, markup, options)
  super
  if markup =~ Syntax
    @to = Regexp.last_match(1)
  else
    raise SyntaxError, options[:locale].t("errors.syntax.capture")
  end
end

Public Instance Methods

blank?() click to toggle source
# File lib/liquid/tags/capture.rb, line 38
def blank?
  true
end
render_to_output_buffer(context, output) click to toggle source
# File lib/liquid/tags/capture.rb, line 30
def render_to_output_buffer(context, output)
  context.resource_limits.with_capture do
    capture_output = render(context)
    context.scopes.last[@to] = capture_output
  end
  output
end