blob: 43a9e3a07f2d2b8928daad58e7f4903888db0a95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "sample.h"
mrb_value sample_api_method(mrb_state *mrb)
{
return mrb_nil_value();
}
void sample_deprecated_method( void )
{
}
/**
* A sample Ruby method defined from C
*/
mrb_value mrb_Sample_Hello__world(mrb_state *mrb, mrb_value self)
{
return sample_inline_method( mrb_str_new_cstr(mrb, "Hello World!" ) );
}
void
mrb_sample_gem_init(mrb_state *mrb)
{
struct RClass *Sample = mrb_define_module(mrb, "Sample");
struct RClass *Sample_Hello = mrb_define_class_under(mrb, Sample, "Hello", mrb->object_class);
mrb_define_method(mrb,Sample_Hello, "world", mrb_Sample_Hello__world, MRB_ARGS_NONE() );
}
void
mrb_sample_gem_final(mrb_state *mrb)
{
// Your C finalization code goes here
}
|