Module: SharedMustache::Hogan
- Defined in:
- lib/shared_mustache/hogan.rb
Class Method Summary collapse
Class Method Details
.compile(source) ⇒ Object
5 6 7 |
# File 'lib/shared_mustache/hogan.rb', line 5 def self.compile(source) context.eval("(typeof exports !== 'undefined' ? exports : Hogan).compile(#{source.inspect}, {asString: true})") end |
.context ⇒ Object
11 12 13 |
# File 'lib/shared_mustache/hogan.rb', line 11 def self.context @context ||= ExecJS.compile(hogan_source) end |
.hogan_source ⇒ Object
15 16 17 18 |
# File 'lib/shared_mustache/hogan.rb', line 15 def self.hogan_source hogan_path = File.('../../vendor/assets/javascripts/hogan-2.0.0.js', File.dirname(__FILE__)) File.read(hogan_path) end |