Module: Ice

Defined in:
lib/ice.rb,
lib/ice/cubeable.rb,
lib/ice/base_cube.rb,
lib/ice/cube_association.rb

Defined Under Namespace

Modules: CubeAssociation, Cubeable Classes: BaseCube

Class Method Summary collapse

Class Method Details

.convert_template(template_text, vars = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ice.rb', line 37

def self.convert_template(template_text, vars = {})

  V8::Context.new do |cxt|
    cxt.load "#{File.dirname(__FILE__)}/parser.js"

    vars.each_pair do |key, value|
      cxt[key] = value.to_ice
    end

    cxt['____templateText'] = template_text

    @evaled = cxt.eval "Jst.evaluate(Jst.compile(____templateText), {});"

  end
  @evaled
end