From 731c5326b47b34364b2a8f69c6d558f52957a562 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 23 Sep 2015 11:42:28 -0300 Subject: Detecting classes and methods from C sources --- sample/.yardopts | 4 +++- sample/README.md | 2 +- sample/src/sample.c | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sample') diff --git a/sample/.yardopts b/sample/.yardopts index 3b09c69..41b06ea 100644 --- a/sample/.yardopts +++ b/sample/.yardopts @@ -1 +1,3 @@ -mrblib/**/*.rb - README.md LICENSE.txt +--plugin mruby +mrblib/**/*.rb +src/**/*.c diff --git a/sample/README.md b/sample/README.md index 1dea126..657e051 100644 --- a/sample/README.md +++ b/sample/README.md @@ -1,4 +1,4 @@ -# sample +# Sample MRuby GEM TODO: Write your README diff --git a/sample/src/sample.c b/sample/src/sample.c index 43a9e3a..e5cbae7 100644 --- a/sample/src/sample.c +++ b/sample/src/sample.c @@ -11,6 +11,8 @@ void sample_deprecated_method( void ) /** * A sample Ruby method defined from C + * + * @return [String] Hello World! */ mrb_value mrb_Sample_Hello__world(mrb_state *mrb, mrb_value self) { @@ -20,9 +22,9 @@ mrb_value mrb_Sample_Hello__world(mrb_state *mrb, mrb_value self) 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() ); + struct RClass *ns = mrb_define_module(mrb, "Sample"); + struct RClass *cl = mrb_define_class_under(mrb, ns, "Hello", mrb->object_class); + mrb_define_method(mrb,cl, "world", mrb_Sample_Hello__world, MRB_ARGS_NONE() ); } void -- cgit v1.2.3