Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ScriptingContainer ruby;
- @Test
- //@Ignore
- public void testJRuby() {
- ruby = new ScriptingContainer(LocalVariableBehavior.PERSISTENT);
- // Assign the Java objects that you want to share
- ruby.put("main", this);
- // Execute a script (can be of any length, and taken from a file)
- Object result = ruby.runScriptlet("main.hello_world");
- // Use the result as if it were a Java object
- System.out.println(result);
- }
- public String getHelloWorld() {
- return "Hello, worlds!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement