Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@nasser /a.rb
Created Aug 5, 2011

Rubinius Embed Example
puts __FILE__
def salad
"caesar"
end
foo
puts salad
puts __FILE__
puts "This is file b"
#include "embed.h"
int main(int argc, char** argv) {
rbx_ctx rbx = rbx_create_context();
printf("** rbx_require_file\n");
rbx_require_file(rbx, "req.rb");
printf("\n** rbx_eval_file\n");
rbx_eval_file(rbx, "a.rb");
printf("\n** rbx_eval_file\n");
rbx_eval_file(rbx, "b.rb");
printf("\n** rbx_eval\n");
rbx_eval(rbx, "puts 'Hello, World!';10.times { |i| puts \"Hello, W#{'o' * (i+2)}rld!\" }");
rbx_close_context(rbx);
return 0;
}
def foo
puts "foo method called"
end
puts "#{__FILE__} required"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.