/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

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