Class: Knj::Jruby_compiler

Inherits:
Object show all
Defined in:
lib/knj/jruby_compiler.rb

Instance Method Summary collapse

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

#runObject



11
12
13
# File 'lib/knj/jruby_compiler.rb', line 11

def run
  @script.eval
end