Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Rubinius Embed Example

View a.rb
1 2 3 4 5 6 7 8
puts __FILE__
 
def salad
"caesar"
end
 
foo
puts salad
View a.rb
1 2 3
puts __FILE__
 
puts "This is file b"
View a.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 
#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;
}
View a.rb
1 2 3 4 5
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.