Class: Jsrb::NotFastGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/jsrb/not_fast_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.contextObject



13
14
15
16
17
18
# File 'lib/jsrb/not_fast_generator.rb', line 13

def context
  @context ||= begin
    code = Stitch::Package.new(root: "#{source_path}/", dependencies: "#{source_path}/escodegen.browser.js").compile
    ExecJS.compile(code)
  end
end

.source_pathObject



20
21
22
# File 'lib/jsrb/not_fast_generator.rb', line 20

def source_path
  File.expand_path(File.join(File.dirname(__FILE__), './vendor'))
end

Instance Method Details

#call(node) ⇒ Object



8
9
10
# File 'lib/jsrb/not_fast_generator.rb', line 8

def call(node)
  self.class.context.call('this.escodegen.generate', node)
end