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 264
264:       def compile(precompiler, text)
265:         return if precompiler.options[:suppress_eval]
266:         precompiler.instance_eval do
267:           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", ';')
268:         end
269:       end

[Validate]