Module Haml::Filters::Ruby
In: lib/haml/filters.rb

Parses the filtered text with the normal Ruby interpreter. All output sent to `$stdout`, such as with `puts`, is output into the Haml document. Not available if the {file:HAML_REFERENCE.md#suppress_eval-option `:suppress_eval`} option is set to true. The Ruby code is evaluated in the same context as the Haml template.

Methods

compile  

Included Modules

Base

Public Instance methods

@see Base#compile

[Source]

     # File lib/haml/filters.rb, line 236
236:       def compile(precompiler, text)
237:         return if precompiler.options[:suppress_eval]
238:         precompiler.instance_eval do
239:           push_silent "_haml_old_stdout = $stdout\n$stdout = StringIO.new(_hamlout.buffer, 'a')\n".gsub("\n", ';') + text + "_haml_old_stdout, $stdout = $stdout, _haml_old_stdout\n_haml_old_stdout.close\n".gsub("\n", ';')
240:         end
241:       end

[Validate]