Kouhei Sutou
null+****@clear*****
Sun Jan 28 23:54:43 JST 2018
Kouhei Sutou 2018-01-28 23:54:43 +0900 (Sun, 28 Jan 2018) New Revision: e8fc44e7afc2e67dce74efa82ed23c07ef9b476b https://github.com/ranguba/rroonga/commit/e8fc44e7afc2e67dce74efa82ed23c07ef9b476b Message: Add Procedure#stable? Modified files: ext/groonga/rb-grn-procedure.c test/test-procedure.rb Modified: ext/groonga/rb-grn-procedure.c (+16 -1) =================================================================== --- ext/groonga/rb-grn-procedure.c 2018-01-28 23:51:43 +0900 (c1b095d9) +++ ext/groonga/rb-grn-procedure.c 2018-01-28 23:54:43 +0900 (6bb99399) @@ -1,6 +1,6 @@ /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2009-2014 Kouhei Sutou <kou �� clear-code.com> + Copyright (C) 2009-2018 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -50,6 +50,19 @@ rb_grn_procedure_get_type (VALUE self) return INT2NUM(type); } +static VALUE +rb_grn_procedure_stable_p (VALUE self) +{ + grn_ctx *context; + grn_obj *procedure; + grn_bool is_stable; + + procedure = RVAL2GRNOBJECT(self, &context); + is_stable = grn_proc_is_stable(context, procedure); + + return CBOOL2RVAL(is_stable); +} + void rb_grn_init_procedure (VALUE mGrn) { @@ -62,4 +75,6 @@ rb_grn_init_procedure (VALUE mGrn) rb_define_const(rb_cGrnProcedure, "MECAB", INT2NUM(GRN_DB_MECAB)); rb_define_method(rb_cGrnProcedure, "type", rb_grn_procedure_get_type, 0); + + rb_define_method(rb_cGrnProcedure, "stable?", rb_grn_procedure_stable_p, 0); } Modified: test/test-procedure.rb (+7 -1) =================================================================== --- test/test-procedure.rb 2018-01-28 23:51:43 +0900 (c114ff6a) +++ test/test-procedure.rb 2018-01-28 23:54:43 +0900 (db0e32cd) @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2014 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2009-2018 Kouhei Sutou <kou �� clear-code.com> # Copyright (C) 2015 Masafumi Yokoyama <yokoyama �� clear-code.com> # # This library is free software; you can redistribute it and/or @@ -58,6 +58,12 @@ class ProcedureTest < Test::Unit::TestCase end end + def test_stable? + assert do + not Groonga["rand"].stable? + end + end + private def assert_equal_procedure(expected_name, id, options={}) procedure = Groonga::Context.default[id] -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180128/78bfeae5/attachment-0001.htm