Created
March 25, 2011 02:22
-
-
Save cowboyd/886256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ruby; | |
import org.jruby.RubyClass; | |
import org.jruby.RubyObject; | |
import org.jruby.embed.ScriptingContainer; | |
public class ERBSpike { | |
public static void main(String[] args) { | |
ScriptingContainer jruby = new ScriptingContainer(); | |
jruby.runScriptlet("require 'erb'"); | |
RubyClass erb = (RubyClass) jruby.runScriptlet("ERB"); | |
RubyObject template = (RubyObject) jruby.callMethod(erb, "new", "Hello <%= @name %>"); | |
String result = jruby.callMethod(template, "result"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment