mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
![]() This adds the ability embed basic Ruby code blocks into a javascript context and invoke it. cxt = V8::Context.new cxt['twice'] = lambda {|str| "#{str}#{str}"} cxt.eval('twice("hi")') #=> "hihi" Note that error handling is not accounted for yet. If an exception happens inside the called proc, it will cause terrible, awful things to happen because portions of the C++ stack will not be unwound leaving the Isolate in an indeterminate state. |
||
---|---|---|
.. | ||
v8 | ||
therubyracer.rb | ||
v8.rb |