Sha256: 2cfcb036ff093f238d1ffe3ceb3034882ed0a4020794e5593282b986d88c1010

Contents?: true

Size: 556 Bytes

Versions: 4

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

require 'execjs'
require 'stitch'

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jsrb-0.3.0 lib/jsrb/not_fast_generator.rb
jsrb-0.2.1 lib/jsrb/not_fast_generator.rb
jsrb-0.2.0 lib/jsrb/not_fast_generator.rb
jsrb-0.1.0 lib/jsrb/not_fast_generator.rb