Kouhei Sutou
null+****@clear*****
Mon Aug 29 16:10:00 JST 2016
Kouhei Sutou 2016-08-29 16:10:00 +0900 (Mon, 29 Aug 2016) New Revision: 3fc7508421d661c8559171596e745d38b9cd4a5e https://github.com/groonga/groonga/commit/3fc7508421d661c8559171596e745d38b9cd4a5e Message: mrb: add Context.opened? Modified files: lib/mrb/mrb_ctx.c Modified: lib/mrb/mrb_ctx.c (+15 -1) =================================================================== --- lib/mrb/mrb_ctx.c 2016-08-29 15:57:31 +0900 (1d33e9c) +++ lib/mrb/mrb_ctx.c 2016-08-29 16:10:00 +0900 (1edab7f) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2013-2015 Brazil + Copyright(C) 2013-2016 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -262,6 +262,17 @@ ctx_get_database(mrb_state *mrb, mrb_value self) return grn_mrb_value_from_grn_obj(mrb, grn_ctx_db(ctx)); } +static mrb_value +ctx_is_opened(mrb_state *mrb, mrb_value self) +{ + grn_ctx *ctx = (grn_ctx *)mrb->ud; + mrb_int mrb_id; + + mrb_get_args(mrb, "i", &mrb_id); + + return mrb_bool_value(grn_ctx_is_opened(ctx, mrb_id)); +} + void grn_mrb_ctx_check(mrb_state *mrb) { @@ -814,5 +825,8 @@ grn_mrb_ctx_init(grn_ctx *ctx) mrb_define_method(mrb, klass, "database", ctx_get_database, MRB_ARGS_NONE()); + + mrb_define_method(mrb, klass, "opened?", ctx_is_opened, + MRB_ARGS_REQ(1)); } #endif -------------- next part -------------- HTML����������������������������...Download