Class: Haml::Compiler

### Home Classes Methods

### In Files

- lib/haml/compiler.rb
- lib/haml/template.rb

### Parent

Object

### Methods

- ::new
- #compile
- #precompiled
- #precompiled_method_return_value_with_haml_xss
- #precompiled_method_return_value_without_haml_xss
- #precompiled_with_ambles
- #precompiled_with_return_value

### Included Modules

- Haml::Util

### 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::Compiler

### Attributes

options[RW]

### Public Class Methods

new(options) click to toggle source

    # File lib/haml/compiler.rb, line 9
    def initialize(options)
      @options     = options
      @output_tabs = 0
      @to_merge    = []
      @precompiled = ''
    end

### Public Instance Methods

compile(node) click to toggle source

    # File lib/haml/compiler.rb, line 16
    def compile(node)
      parent = instance_variable_defined?('@node') ? @node : nil
      @node = node
      if node.children.empty?
        send(:"compile_#{node.type}")
      else
        send(:"compile_#{node.type}") {node.children.each {|c| compile c}}
      end
    ensure
      @node = parent
    end

precompiled() click to toggle source

The source code that is evaluated to produce the Haml document.

In Ruby 1.9, this is automatically converted to the correct encoding (see {file:REFERENCE.md#encodings the `:encoding` option}).

@return [String]

    # File lib/haml/compiler.rb, line 35
    def precompiled
      @precompiled
    end

precompiled_method_return_value_with_haml_xss() click to toggle source

    # File lib/haml/template.rb, line 10
    def precompiled_method_return_value_with_haml_xss
      "::Haml::Util.html_safe(#{precompiled_method_return_value_without_haml_xss})"
    end

Also aliased as: precompiled_method_return_value
precompiled_method_return_value_without_haml_xss() click to toggle source
Alias for: precompiled_method_return_value
precompiled_with_ambles(local_names) click to toggle source

Returns the precompiled string with the preamble and postamble.

Initializes to ActionView::OutputBuffer when available; this is necessary to avoid ordering issues with partial layouts in Rails. If not available, initializes to nil.

    # File lib/haml/compiler.rb, line 55
    def precompiled_with_ambles(local_names)
      preamble = beginextend Haml::Helpers_hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options.for_buffer.inspect})_erbout = _hamlout.buffer@output_buffer = output_buffer ||= ActionView::OutputBuffer.new rescue nil.gsub("\n", ";")
      postamble = #{precompiled_method_return_value}ensure@haml_buffer = @haml_buffer.upper if @haml_bufferend.gsub("\n", ";")
      preamble + locals_code(local_names) + precompiled + postamble
    end

precompiled_with_return_value() click to toggle source

    # File lib/haml/compiler.rb, line 46
    def precompiled_with_return_value
      precompiled + ";" + precompiled_method_return_value
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.