Parent

Included Modules

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() click to toggle source
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
precompiled_method_return_value_without_haml_xss() click to toggle source
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.