Class: Haml::Sprockets::Template
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Haml::Sprockets::Template
- Defined in:
- lib/haml-sprockets.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.engine_initialized? ⇒ Boolean
9 10 11 |
# File 'lib/haml-sprockets.rb', line 9 def self.engine_initialized? true end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/haml-sprockets.rb', line 19 def evaluate(scope, locals, &block) haml_code = data.dup haml_code = haml_code.gsub(/\\/,"\\\\").gsub(/\'/,"\\\\'").gsub(/\n/,"\\n") haml_lib = File.read("#{::Rails.root}/vendor/assets/javascripts/haml.js") context = ExecJS.compile(haml_lib) return context.eval("Haml.optimize(Haml.compile('#{haml_code}', {escapeHtmlByDefault: true}))") end |
#initialize_engine ⇒ Object
13 14 |
# File 'lib/haml-sprockets.rb', line 13 def initialize_engine end |
#prepare ⇒ Object
16 17 |
# File 'lib/haml-sprockets.rb', line 16 def prepare end |