Class: ReActionView::Template::Handlers::Herb::Herb

Inherits:
Herb::Engine
  • Object
show all
Defined in:
lib/reactionview/template/handlers/herb/herb.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Herb.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/reactionview/template/handlers/herb/herb.rb', line 10

def initialize(input, properties = {})
  @newline_pending = 0

  # Dup properties so that we don't modify argument
  properties = properties.to_h

  properties[:bufvar]     ||= "@output_buffer"
  properties[:preamble]   ||= ""
  properties[:postamble]  ||= properties[:bufvar].to_s

  # Tell Herb whether the template will be compiled with `frozen_string_literal: true`
  properties[:freeze_template_literals] = !::ActionView::Template.frozen_string_literal

  # Disable all Herb escape functions - let ActionView::OutputBuffer handle escaping
  properties[:escapefunc] = ""
  properties[:attrfunc] = nil
  properties[:jsfunc] = nil
  properties[:cssfunc] = nil

  super
end