Kouhei Sutou
null+****@clear*****
Tue Jan 30 15:54:26 JST 2018
Kouhei Sutou 2018-01-30 15:54:26 +0900 (Tue, 30 Jan 2018) New Revision: b1c3acc055f2cda760b6c99f085707cf5da2461b https://github.com/ranguba/rroonga/commit/b1c3acc055f2cda760b6c99f085707cf5da2461b Message: Add Object#corrupt? Modified files: ext/groonga/rb-grn-object.c test/test-database.rb Modified: ext/groonga/rb-grn-object.c (+21 -0) =================================================================== --- ext/groonga/rb-grn-object.c 2018-01-30 15:50:06 +0900 (ee160f13) +++ ext/groonga/rb-grn-object.c 2018-01-30 15:54:26 +0900 (b8621905) @@ -1970,6 +1970,25 @@ rb_grn_object_dirty_p (VALUE self) return CBOOL2RVAL(is_dirty); } +/* + * @overload corrupt? + * @return [Boolean] `true` if the object is corrupt, `false` otherwise. + * + * @since 7.1.1 + */ +static VALUE +rb_grn_object_corrupt_p (VALUE self) +{ + grn_ctx *context; + grn_obj *object; + grn_bool is_corrupt; + + rb_grn_object_deconstruct(SELF(self), &object, &context, + NULL, NULL, NULL, NULL); + is_corrupt = grn_obj_is_corrupt(context, object); + return CBOOL2RVAL(is_corrupt); +} + void rb_grn_init_object (VALUE mGrn) { @@ -2032,4 +2051,6 @@ rb_grn_init_object (VALUE mGrn) rb_grn_object_get_last_modified, 0); rb_define_method(rb_cGrnObject, "dirty?", rb_grn_object_dirty_p, 0); + rb_define_method(rb_cGrnObject, "corrupt?", + rb_grn_object_corrupt_p, 0); } Modified: test/test-database.rb (+6 -0) =================================================================== --- test/test-database.rb 2018-01-30 15:50:06 +0900 (4dceb572) +++ test/test-database.rb 2018-01-30 15:54:26 +0900 (45e71ee1) @@ -405,5 +405,11 @@ class DatabaseTest < Test::Unit::TestCase @database.dirty? end end + + def test_corrupt? + assert do + not****@datab*****? + end + end end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180130/8340e22b/attachment-0001.htm