Kouhei Sutou
null+****@clear*****
Tue Feb 3 12:51:39 JST 2015
Kouhei Sutou 2015-02-03 12:51:39 +0900 (Tue, 03 Feb 2015) New Revision: f34909c5fd5939e92d7a1097b5ce34ccd10c4c15 https://github.com/groonga/groonga/commit/f34909c5fd5939e92d7a1097b5ce34ccd10c4c15 Message: mrb: add Context#database Modified files: lib/mrb/mrb_ctx.c Modified: lib/mrb/mrb_ctx.c (+11 -0) =================================================================== --- lib/mrb/mrb_ctx.c 2015-02-03 12:51:07 +0900 (e975cdd) +++ lib/mrb/mrb_ctx.c 2015-02-03 12:51:39 +0900 (33c7581) @@ -199,6 +199,14 @@ ctx_set_error_message(mrb_state *mrb, mrb_value self) } static mrb_value +ctx_get_database(mrb_state *mrb, mrb_value self) +{ + grn_ctx *ctx = (grn_ctx *)mrb->ud; + + return grn_mrb_value_from_grn_obj(mrb, grn_ctx_db(ctx)); +} + +static mrb_value ctx_output(mrb_state *mrb, mrb_value self) { grn_ctx *ctx = (grn_ctx *)mrb->ud; @@ -734,6 +742,9 @@ grn_mrb_ctx_init(grn_ctx *ctx) mrb_define_method(mrb, klass, "error_message=", ctx_set_error_message, MRB_ARGS_REQ(1)); + mrb_define_method(mrb, klass, "database", ctx_get_database, + MRB_ARGS_NONE()); + mrb_define_method(mrb, klass, "output", ctx_output, MRB_ARGS_REQ(1)); } -------------- next part -------------- HTML����������������������������...Download