mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
Merge remote-tracking branch 'bronson/patch-1'
This commit is contained in:
commit
59508cc8a4
1 changed files with 6 additions and 0 deletions
|
@ -31,6 +31,12 @@ evaluate some simple JavaScript
|
||||||
cxt = V8::Context.new
|
cxt = V8::Context.new
|
||||||
cxt.eval('7 * 6') #=> 42
|
cxt.eval('7 * 6') #=> 42
|
||||||
|
|
||||||
|
call JavaScript functions
|
||||||
|
|
||||||
|
cxt.eval "function isTruthy(arg) { return !!arg }"
|
||||||
|
cxt[:isTruthy].call(' ') #=> true
|
||||||
|
cxt.scope.isTruthy(0) #=> false
|
||||||
|
|
||||||
embed values into the scope of your context
|
embed values into the scope of your context
|
||||||
|
|
||||||
cxt['foo'] = "bar"
|
cxt['foo'] = "bar"
|
||||||
|
|
Loading…
Add table
Reference in a new issue