[Groonga-commit] groonga/groonga at 8ff4ef9 [master] mrb: define Kernel#load

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 3 13:54:41 JST 2014


Kouhei Sutou	2014-11-03 13:54:41 +0900 (Mon, 03 Nov 2014)

  New Revision: 8ff4ef9ef254c402a0ea3a790d1e6b6c5e359c01
  https://github.com/groonga/groonga/commit/8ff4ef9ef254c402a0ea3a790d1e6b6c5e359c01

  Message:
    mrb: define Kernel#load

  Modified files:
    lib/ctx_impl_mrb.c

  Modified: lib/ctx_impl_mrb.c (+18 -0)
===================================================================
--- lib/ctx_impl_mrb.c    2014-11-03 13:54:16 +0900 (1d1b7f4)
+++ lib/ctx_impl_mrb.c    2014-11-03 13:54:41 +0900 (e13223f)
@@ -39,6 +39,21 @@
 #include "mrb/mrb_procedure.h"
 
 #ifdef GRN_WITH_MRUBY
+static mrb_value
+mrb_kernel_load(mrb_state *mrb, mrb_value self)
+{
+  grn_ctx *ctx = (grn_ctx *)mrb->ud;
+  char *path;
+
+  mrb_get_args(mrb, "z", &path);
+
+  grn_mrb_load(ctx, path);
+
+  grn_mrb_ctx_check(mrb);
+
+  return mrb_true_value();
+}
+
 static void
 grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
 {
@@ -47,6 +62,9 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
   mrb->ud = ctx;
   ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga");
 
+  mrb_define_method(mrb, mrb->kernel_module,
+                    "load", mrb_kernel_load, MRB_ARGS_REQ(1));
+
   grn_mrb_load(ctx, "backtrace_entry.rb");
 
   grn_mrb_error_init(ctx);
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index