Unverified Commit a97f085c authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5083 from wataash/example-clarify-caller

examples/mrbgems: clarify the caller
parents dffe4bc8 2bf9fd06
module CRubyExtension module CRubyExtension
def CRubyExtension.ruby_method def CRubyExtension.ruby_method
puts "A Ruby Extension" puts "#{self}: A Ruby Extension"
end end
end end
#include <mruby.h> #include <mruby.h>
#include <mruby/string.h>
#include <stdio.h> #include <stdio.h>
static mrb_value static mrb_value
mrb_c_method(mrb_state *mrb, mrb_value self) mrb_c_method(mrb_state *mrb, mrb_value self)
{ {
puts("A C Extension"); mrb_value self_str = mrb_str_to_str(mrb, self);
printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
return self; return self;
} }
......
#include <mruby.h> #include <mruby.h>
#include <mruby/string.h>
#include <stdio.h> #include <stdio.h>
static mrb_value static mrb_value
mrb_c_method(mrb_state *mrb, mrb_value self) mrb_c_method(mrb_state *mrb, mrb_value self)
{ {
puts("A C Extension"); mrb_value self_str = mrb_str_to_str(mrb, self);
printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
return self; return self;
} }
......
class RubyExtension class RubyExtension
def RubyExtension.ruby_method def RubyExtension.ruby_method
puts "A Ruby Extension" puts "#{self}: A Ruby Extension"
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment