Skip to content

Commit

Permalink
Use _p suffix for query methods
Browse files Browse the repository at this point in the history
To match a convention used in the Ruby codebase, use _p at the end of a
method for methods ending in a question mark rather than _query.
  • Loading branch information
mudge committed Oct 22, 2022
1 parent ac29a22 commit b4df488
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ext/re2/re2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ static VALUE re2_regexp_match(int argc, VALUE *argv, VALUE self) {
*
* @return [Boolean] whether the match was successful
*/
static VALUE re2_regexp_match_query(VALUE self, VALUE text) {
static VALUE re2_regexp_match_p(VALUE self, VALUE text) {
VALUE argv[2];
argv[0] = text;
argv[1] = INT2FIX(0);
Expand Down Expand Up @@ -1696,11 +1696,11 @@ void Init_re2(void) {
rb_define_method(re2_cRegexp, "match", RUBY_METHOD_FUNC(re2_regexp_match),
-1);
rb_define_method(re2_cRegexp, "match?",
RUBY_METHOD_FUNC(re2_regexp_match_query), 1);
RUBY_METHOD_FUNC(re2_regexp_match_p), 1);
rb_define_method(re2_cRegexp, "=~",
RUBY_METHOD_FUNC(re2_regexp_match_query), 1);
RUBY_METHOD_FUNC(re2_regexp_match_p), 1);
rb_define_method(re2_cRegexp, "===",
RUBY_METHOD_FUNC(re2_regexp_match_query), 1);
RUBY_METHOD_FUNC(re2_regexp_match_p), 1);
rb_define_method(re2_cRegexp, "scan",
RUBY_METHOD_FUNC(re2_regexp_scan), 1);
rb_define_method(re2_cRegexp, "to_s", RUBY_METHOD_FUNC(re2_regexp_to_s), 0);
Expand Down

0 comments on commit b4df488

Please sign in to comment.