1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00

cleanup the blorted README. I never did learn how to write proper rdoc

This commit is contained in:
Charles Lowell 2009-09-24 21:45:05 -05:00
parent 10123254da
commit 85df8548ef

View file

@ -13,27 +13,29 @@ Embed the Mozilla Rhino Javascript interpreter into Ruby
== SYNOPSIS:
1) Javascript goes into Ruby
1. Javascript goes into Ruby
1. Ruby Objects goes into Javascript
1. Our shark's in the Javascript!
2) Ruby Objects goes into Javascript
3) Our shark's in the Javascript!
include Rhino
# evaluate some simple javascript
#evaluate some simple javascript
Rhino::Context.open do |context|
context.evaljs("7 * 6") #=> 42
end
#Evaluate a ruby function from javascript
Rhino::Context.open do |context|
context.standard do |scope|
scope.put("say", scope, function {|word, times| word * times})
context.evaljs("say("Hello", 3)") #=> HelloHelloHello
Rhino::Context.open do |context|
context.evaljs("7 * 6") #=> 42
end
end
# evaluate a ruby function from javascript
include Rhino
Rhino::Context.open do |context|
context.standard do |scope|
scope.put("say", scope, function {|word, times| word * times})
context.evaljs("say("Hello", 3)") #=> HelloHelloHello
end
end
== REQUIREMENTS:
* JRuby >= 1.3.0