Class: Knj::Jruby_compiler
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Jruby_compiler
constructor
A new instance of Jruby_compiler.
- #run ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Jruby_compiler
Returns a new instance of Jruby_compiler.
2 3 4 5 6 7 8 9 |
# File 'lib/knj/jruby_compiler.rb', line 2 def initialize(args = {}) @args = args factory = javax.script.ScriptEngineManager.new engine = factory.getEngineByName("jruby") code = File.read(args[:path]) @script = engine.compile(code) end |
Instance Method Details
#run ⇒ Object
11 12 13 |
# File 'lib/knj/jruby_compiler.rb', line 11 def run @script.eval end |