Class: Erubi::CaptureEngine

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

Overview

An engine class that supports capturing blocks via the <%|= and <%|== tags.

Instance Attribute Summary

Attributes inherited from Engine

#bufvar, #filename, #src

Instance Method Summary collapse

Constructor Details

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

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.



63
64
65
66
67
68
69
70
# File 'lib/erubi/capture.rb', line 63

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