Ruby: def foo; end
YARV: definemethod foo
C API:
rb_define_global_function(
"foo", my_method, argc
);
Slide 12
Slide 12 text
class.c
Slide 13
Slide 13 text
Top level methods are stored in the Kernel module
> puts 25
25
=> nil
> Kernel.puts 25
25
=> nil
Slide 14
Slide 14 text
Top level methods are stored in the Kernel module
> def foo = 420
=> :foo
> Kernel.private_methods
=>
[..., :foo, ...]
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
PseudoRuby
Examples
Slide 17
Slide 17 text
Init the VM
Slide 18
Slide 18 text
Sum of 2 numbers
Slide 19
Slide 19 text
Sum of 2 numbers
Slide 20
Slide 20 text
Area of circle
Slide 21
Slide 21 text
Area of circle
Slide 22
Slide 22 text
Define module and class
Slide 23
Slide 23 text
You can do all of it (I think)
rb_require(...);
rb_load(...);
rb_raise(
rb_eRuntimeError,
"Error code %d",
404
);
VALUE gv;
rb_gv_set("$x", gv);
gv = rb_gv_get("$x");
iv = rb_iv_get(obj, "@x");