Reputation: 18169
From this page: https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
In a Ruby script, if you use require 'java'
, the script will be able to create things like JFrame
s and such.
It may sound odd, but, is it possible, in any way, to not allow such feature (disable importing Java
)?
If you are curious as to why am I asking, it is because I'm developing some kind of game engine on Java, but it allows users to script with Ruby to control the game logic - only the game logic. I don't want to give the freedom of creating JFrame
s.
Upvotes: 2
Views: 124
Reputation: 1426
One hack would be to put 'java' into loaded features (the $" array). Requires would then assume it's already loaded and not try to load it again. A user could certainly remove it from that array, and try again, though.
Upvotes: 1