Skip to content

Instantly share code, notes, and snippets.

Created January 8, 2010 00:34
Show Gist options
  • Save headius/271764 to your computer and use it in GitHub Desktop.
Save headius/271764 to your computer and use it in GitHub Desktop.
~/projects/jruby ➔ gem install com.lowagie.itext-rtf
Successfully installed bouncycastle.bcmail-jdk14-138-java
Successfully installed bouncycastle.bcprov-jdk14-138-java
Successfully installed bouncycastle.bctsp-jdk14-138-java
Successfully installed com.lowagie.itext-rtf-2.1.7-java
4 gems installed
Installing ri documentation for bouncycastle.bcmail-jdk14-138-java...
Installing ri documentation for bouncycastle.bcprov-jdk14-138-java...
Installing ri documentation for bouncycastle.bctsp-jdk14-138-java...
Installing ri documentation for com.lowagie.itext-rtf-2.1.7-java...
Installing RDoc documentation for bouncycastle.bcmail-jdk14-138-java...
Installing RDoc documentation for bouncycastle.bcprov-jdk14-138-java...
Installing RDoc documentation for bouncycastle.bctsp-jdk14-138-java...
Installing RDoc documentation for com.lowagie.itext-rtf-2.1.7-java...
~/projects/jruby ➔ gem list -r rhino
rhino.js (999.0.0)
rhino.rhino (
~/projects/jruby ➔ gem install rhino.rhino
Successfully installed rhino.rhino-
1 gem installed
Installing ri documentation for rhino.rhino-
Installing RDoc documentation for rhino.rhino-
~/projects/jruby ➔ jirb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rhino.rhino'
=> true
irb(main):003:0> ctx = org.mozilla.javascript.Context.enter
=> org.mozilla.javascript.Context@5d1d20d3
irb(main):004:0> scope = ctx.init_standard_objects nil
=> [object Object]
irb(main):005:0> result = ctx.evaluate_string scope, 'function f(x){return x+1} f(7)', 'x', 1, nil
=> 8.0
irb(main):006:0> quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment