Module: Jade

Defined in:
lib/ruby-jade.rb

Class Method Summary collapse

Class Method Details

.compile(template, options = {}) ⇒ Object



22
23
24
25
# File 'lib/ruby-jade.rb', line 22

def compile(template, options = {})
  options = {:client => true, :compileDebug => false}.merge(options)
  context.call('compile', template, options)
end

.contextObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby-jade.rb', line 10

def context
  @context ||= begin
    ExecJS.compile "      var window = {};\n      \#{File.read(path)}\n      var compile = function (template, options) {\n        return window.jade.compile(template, options).toString();\n      }\n    JS\n  end\nend\n"

.pathObject



6
7
8
# File 'lib/ruby-jade.rb', line 6

def path
  File.expand_path '../ruby-jade/jade.min.js', __FILE__
end