Sha256: 361e41b174099151269613088c7e46b882b8fffeba51052ef1d7bdefd29b0ced
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require "java" $: << CLOJURESCRIPT_LIB %w{clojure.jar compiler.jar goog.jar js.jar}.each {|name| $CLASSPATH << CLOJURESCRIPT_LIB + name} %w{clj cljs}.each {|path| $CLASSPATH << CLOJURESCRIPT_HOME + "/src/" + path} require 'clementine/clojurescript_engine/base' %w{RT Keyword PersistentHashMap}.each do |name| java_import "clojure.lang.#{name}" end module Clementine class ClojureScriptEngine < ClojureScriptEngineBase def initialize(file, options) @file = file @options = options end def compile @options = Clementine.options if @options.empty? cl_opts = PersistentHashMap.create(convert_options(@options)) RT.loadResourceScript("cljs/closure.clj") builder = RT.var("cljs.closure", "build") builder.invoke(@file, cl_opts) end #private def convert_options(options) opts = {} options = options.empty? ? default_opts : options options.each do |k, v| cl_key = Keyword.intern(Clementine.ruby2clj(k.to_s)) case when (v.kind_of? Symbol) cl_value = Keyword.intern(Clementine.ruby2clj(v.to_s)) else cl_value = v end opts[cl_key] = cl_value end opts end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clementine-0.0.2 | lib/clementine/clojurescript_engine/jruby.rb |