1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00

minor fix for time_to_js when scope not set - java_class needs a to_java

This commit is contained in:
kares 2013-12-08 15:36:14 +01:00
parent d128fee525
commit cac2b9512a

View file

@ -81,12 +81,10 @@ module Rhino
JS::ScriptRuntime.newObject(context, scope, 'Date', [ millis ].to_java)
else
# the pure reflection way - god I love Java's private :
js_klass = JS::NativeObject.java_class
new = js_klass.getDeclaredConstructor
new.setAccessible(true)
js_klass = JS::NativeObject.java_class.to_java
new = js_klass.getDeclaredConstructor; new.setAccessible(true)
js_date = new.newInstance
date = js_klass.getDeclaredField(:date)
date.setAccessible(true)
date = js_klass.getDeclaredField(:date); date.setAccessible(true)
date.setDouble(js_date, millis)
js_date
end