-
-
Save nasser/1128709 to your computer and use it in GitHub Desktop.
Rubinius Embed Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts __FILE__ | |
def salad | |
"caesar" | |
end | |
foo | |
puts salad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts __FILE__ | |
puts "This is file b" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Can you share embed.h too?