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 246
246:       def compile(precompiler, text)
247:         return if precompiler.options[:suppress_eval]
248:         precompiler.instance_eval do
249:           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", ';')
250:         end
251:       end

[Validate]