Module: Haml::Filters::Ruby

### Home Classes Methods

### In Files

- lib/haml/filters.rb

### Methods

- #compile

### Included Modules

- Haml::Filters::Base

### Class/Module Index

Quicksearch

- Haml
- Haml::Buffer
- Haml::Compiler
- Haml::Engine
- Haml::Error
- Haml::ErubisTemplateHandler
- Haml::Exec
- Haml::Exec::Generic
- Haml::Exec::Haml
- Haml::Filters
- Haml::Filters::Base
- Haml::Filters::Cdata
- Haml::Filters::Css
- Haml::Filters::Erb
- Haml::Filters::Escaped
- Haml::Filters::Javascript
- Haml::Filters::Plain
- Haml::Filters::PrecompiledTiltFilter
- Haml::Filters::Preserve
- Haml::Filters::Ruby
- Haml::Filters::SassRailsTemplate
- Haml::Filters::ScssRailsTemplate
- Haml::Filters::TiltFilter
- Haml::Helpers
- Haml::Helpers::ActionViewExtensions
- Haml::Helpers::ErrorReturn
- Haml::Helpers::XssMods
- Haml::Options
- Haml::Parser
- Haml::Parser::Line
- Haml::Parser::ParseNode
- Haml::Plugin
- Haml::Railtie
- Haml::SafeErubisTemplate
- Haml::SyntaxError
- Haml::Template
- Haml::Util
- Haml::Util::StaticConditionalContext
- ActionView
- ActionView::Base
- ActionView::Helpers
- ActionView::Helpers::CaptureHelper
- ActionView::Helpers::FormHelper
- ActionView::Helpers::FormTagHelper
- ActionView::Helpers::HamlSupport
- ActionView::Helpers::InstanceTag
- ActionView::Helpers::TagHelper
- ActionView::Helpers::Tags
- ActionView::Helpers::Tags::TextArea
- ActionView::Helpers::TextHelper
- Object

No matching classes.

# Haml::Filters::Ruby

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 {file: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.

### Public Instance Methods

compile(compiler, text) click to toggle source

@see Base#compile

    # File lib/haml/filters.rb, line 288
    def compile(compiler, text)
      return if compiler.options[:suppress_eval]
      compiler.instance_eval do
        push_silent             begin              haml_io = StringIO.new(_hamlout.buffer, 'a').gsub("\n", ';') + text +             ensure              haml_io.close              haml_io = nil            end.gsub("\n", ';')
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.