Class: Erubi::CaptureEndEngine

Inherits:
Engine
  • Object
show all
Defined in:
lib/erubi/capture_end.rb

Overview

An engine class that supports capturing blocks via the <%|= and <%|== tags, explicitly ending the captures using <%| end %> blocks.

Instance Attribute Summary

Attributes inherited from Engine

#bufvar, #filename, #src

Instance Method Summary collapse

Constructor Details

#initialize(input, properties = {}) ⇒ CaptureEndEngine

Initializes the engine. Accepts the same arguments as ::Erubi::Engine, and these additional options:

:escape_capture

Whether to make <%|= escape by default, and <%|== not escape by default, defaults to the same value as :escape.


13
14
15
16
17
18
19
20
21
# File 'lib/erubi/capture_end.rb', line 13

def initialize(input, properties={})
  properties = Hash[properties]
  escape = properties.fetch(:escape){properties.fetch(:escape_html, false)}
  @escape_capture = properties.fetch(:escape_capture, escape)
  @bufval = properties[:bufval] ||= 'String.new'
  @bufstack = '__erubi_stack'
  properties[:regexp] ||= /<%(\|?={1,2}|-|\#|%|\|)?(.*?)([-=])?%>([ \t]*\r?\n)?/m
  super
end