PageRenderTime 28ms CodeModel.GetById 13ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/scalate-jruby/src/main/resources/haml-3.0.25/lib/haml.rb

http://github.com/scalate/scalate
Ruby | 44 lines | 15 code | 5 blank | 24 comment | 0 complexity | eb86491c5e87a52239a36d1a6b45fc58 MD5 | raw file
 1dir = File.dirname(__FILE__)
 2$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
 3
 4require 'haml/version'
 5
 6# The module that contains everything Haml-related:
 7#
 8# * {Haml::Engine} is the class used to render Haml within Ruby code.
 9# * {Haml::Helpers} contains Ruby helpers available within Haml templates.
10# * {Haml::Template} interfaces with web frameworks (Rails in particular).
11# * {Haml::Error} is raised when Haml encounters an error.
12# * {Haml::HTML} handles conversion of HTML to Haml.
13#
14# Also see the {file:HAML_REFERENCE.md full Haml reference}.
15module Haml
16  extend Haml::Version
17
18  # A string representing the version of Haml.
19  # A more fine-grained representation is available from Haml.version.
20  # @api public
21  VERSION = version[:string] unless defined?(Haml::VERSION)
22
23  # Initializes Haml for Rails.
24  #
25  # This method is called by `init.rb`,
26  # which is run by Rails on startup.
27  # We use it rather than putting stuff straight into `init.rb`
28  # so we can change the initialization behavior
29  # without modifying the file itself.
30  #
31  # @param binding [Binding] The context of the `init.rb` file.
32  #   This isn't actually used;
33  #   it's just passed in in case it needs to be used in the future
34  def self.init_rails(binding)
35    # No &method here for Rails 2.1 compatibility
36    %w[haml/template sass sass/plugin].each {|f| require f}
37  end
38end
39
40require 'haml/util'
41unless $0 =~ /sass(-convert)?$/
42  require 'haml/engine'
43  require 'haml/railtie'
44end