PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/scalate/scalate
Ruby | 21 lines | 17 code | 2 blank | 2 comment | 4 complexity | ef9c36072f327ea15c48c7c5952180ba MD5 | raw file
 1if Haml::Util.ap_geq_3? && !Haml::Util.ap_geq?("3.0.0.beta4")
 2  raise <<ERROR
 3Haml and Sass no longer support Rails 3 versions before beta 4.
 4  Please upgrade to Rails 3.0.0.beta4 or later.
 5ERROR
 6end
 7
 8# Rails 3.0.0.beta.2+
 9if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
10  require 'haml/template/options'
11  require 'sass/plugin/configuration'
12  ActiveSupport.on_load(:before_initialize) do
13    require 'sass'
14    require 'sass/plugin'
15
16    # Haml requires AV, but Sass doesn't
17    ActiveSupport.on_load(:action_view) do
18      Haml.init_rails(binding)
19    end
20  end
21end