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:
parent
d128fee525
commit
cac2b9512a
1 changed files with 11 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue