judofyr/duktape.rb — pull request #14 by judofyr (2014-12-15 17:17:14+00:00)
Title: Start working on a Ruby bridge

Example:

```ruby
$LOAD_PATH << 'lib'
require 'duktape'

ctx = Duktape::Context.new(ruby_bridge: true)

ctx.exec_string(<<-JS, __FILE__)
Ruby.decorate = function(obj) {
return new Proxy(obj, {
get: function(target, key) {
if (key == 'toString')
key = 'to_s';

return function() {
var res = Ruby.send(target, key, arguments);
if (Ruby.isObject(res)) {
return Ruby.decorate(res);
} else {
return res;
}
}
}
});
}

var main = Ruby.decorate(Ruby.main)
var DB = main.eval("require 'sequel'; Sequel.sqlite")
print(DB.execute('select 1 + 1').to_a())
JS
```

@josh: Not sure if you need this, but it was cool playing with it.