Module: Haml::Filters::Ruby
- Includes:
- Base
- Defined in:
- lib/haml/filters.rb
Overview
Parses the filtered text with the normal Ruby interpreter. Creates an IO
object named haml_io
, anything written to it is output into the Haml
document. In previous version this filter redirected any output to $stdout
to the Haml document, this was not threadsafe and has been removed, you
should use haml_io
instead.
Not available if the :suppress_eval
option is set to true. The Ruby code is evaluated in the same context as
the Haml template.
Instance Method Summary collapse
Methods included from Base
included, #internal_compile, #render, #render_with_options
Instance Method Details
#compile(compiler, text)
283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/haml/filters.rb', line 283
def compile(compiler, text)
return if compiler.options[:suppress_eval]
compiler.instance_eval do
push_silent "#{<<-FIRST.tr("\n", ';')}#{text}#{<<-LAST.tr("\n", ';')}"
begin
haml_io = StringIO.new(_hamlout.buffer, 'a')
FIRST
ensure
haml_io.close
haml_io = nil
end
LAST
end
end
|