Skip to content

Commit

Permalink
mrb: Add Groonga::Bulk#true?
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 19, 2019
1 parent 3949545 commit a860d78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/mrb/mrb_bulk.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ grn_mrb_bulk_init(grn_ctx *ctx)
mrb_grn_bulk_get_domain, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "value",
mrb_grn_bulk_get_value, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "true?",
grn_mrb_object_is_true, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "==",
mrb_grn_bulk_equal, MRB_ARGS_REQ(1));
mrb_define_method(mrb, klass, "inspect",
Expand Down
8 changes: 5 additions & 3 deletions lib/mrb/mrb_object.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013-2018 Brazil
Copyright(C) 2019 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
Expand Down Expand Up @@ -280,8 +281,8 @@ object_is_persistent(mrb_state *mrb, mrb_value self)
return mrb_bool_value((flags & GRN_OBJ_PERSISTENT) == GRN_OBJ_PERSISTENT);
}

static mrb_value
object_is_true(mrb_state *mrb, mrb_value self)
mrb_value
grn_mrb_object_is_true(mrb_state *mrb, mrb_value self)
{
grn_ctx *ctx = (grn_ctx *)mrb->ud;
grn_obj *object;
Expand Down Expand Up @@ -348,7 +349,8 @@ grn_mrb_object_init(grn_ctx *ctx)
mrb_define_method(mrb, klass, "persistent?", object_is_persistent,
MRB_ARGS_NONE());

mrb_define_method(mrb, klass, "true?", object_is_true, MRB_ARGS_NONE());
mrb_define_method(mrb, klass, "true?", grn_mrb_object_is_true,
MRB_ARGS_NONE());

mrb_define_method(mrb, klass, "check_corrupt", object_check_corrupt,
MRB_ARGS_NONE());
Expand Down
2 changes: 2 additions & 0 deletions lib/mrb/mrb_object.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013-2018 Brazil
Copyright(C) 2019 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
Expand Down Expand Up @@ -29,6 +30,7 @@ void grn_mrb_object_init(grn_ctx *ctx);
mrb_value grn_mrb_object_inspect(mrb_state *mrb, mrb_value self);
mrb_value grn_mrb_object_close(mrb_state *mrb, mrb_value self);
mrb_value grn_mrb_object_is_closed(mrb_state *mrb, mrb_value self);
mrb_value grn_mrb_object_is_true(mrb_state *mrb, mrb_value self);

#ifdef __cplusplus
}
Expand Down

0 comments on commit a860d78

Please sign in to comment.