module Haml::Filters::ERB

Parses the filtered text with ERB. Not available if the {file:HAML_REFERENCE.md#suppress_eval-option `:suppress_eval`} option is set to true. Embedded Ruby code is evaluated in the same context as the Haml template.

Public Instance Methods

compile(compiler, text) click to toggle source

@see Haml::Filters::Base#compile

# File lib/haml/filters.rb, line 323
def compile(compiler, text)
  return if compiler.options[:suppress_eval]
  src = ::ERB.new(text).src.sub(%r^#coding:.*?\n/, '').
    sub(%r^_erbout = '';/, "")
  compiler.send(:push_silent, src)
end