Namespace

Methods

Haml

We keep options in its own self-contained file so that we can load it independently in Rails 3, where the full template stuff is lazy-loaded.


This file makes Haml work with Rails using the > 2.0.1 template handler API.


The module that contains everything Haml-related:

Also see the {file:HAML_REFERENCE.md full Haml reference}.

Constants

ROOT_DIR

The root directory of the Haml source tree. This may be overridden by the package manager if the lib directory is separated from the main source tree. @api public

VERSION

A string representing the version of Haml. A more fine-grained representation is available from Haml.version. @api public

Public Class Methods

init_rails(binding) click to toggle source

Initializes Haml for Rails.

This method is called by `init.rb`, which is run by Rails on startup. We use it rather than putting stuff straight into `init.rb` so we can change the initialization behavior without modifying the file itself.

@param binding [Binding] The context of the `init.rb` file.

  This isn't actually used;
  it's just passed in in case it needs to be used in the future
    # File lib/haml.rb, line 27
27:   def self.init_rails(binding)
28:     # 2.2 <= Rails < 3
29:     if defined?(Rails) && Rails.respond_to?(:configuration) &&
30:         Rails.configuration.respond_to?(:after_initialize) &&
31:         !Haml::Util.ap_geq_3?
32:       Rails.configuration.after_initialize do
33:         next if defined?(Sass)
34:         autoload(:Sass, 'sass/rails2_shim')
35:         # resolve autoload if it looks like they're using Sass without options
36:         Sass if File.exist?(File.join(RAILS_ROOT, 'public/stylesheets/sass'))
37:       end
38:     end
39: 
40:     # No &method here for Rails 2.1 compatibility
41:     ]haml/template].each {|f| require f}
42:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.