Class: FastHaml::TextCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_haml/text_compiler.rb

Defined Under Namespace

Classes: InvalidInterpolation

Instance Method Summary collapse

Constructor Details

#initialize(escape_html: true) ⇒ TextCompiler



9
10
11
# File 'lib/fast_haml/text_compiler.rb', line 9

def initialize(escape_html: true)
  @escape_html = escape_html
end

Instance Method Details

#compile(text, escape_html: @escape_html) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/fast_haml/text_compiler.rb', line 13

def compile(text, escape_html: @escape_html)
  if contains_interpolation?(text)
    compile_interpolation(text, escape_html: escape_html)
  else
    [:static, text]
  end
end