diff --git a/ext/groonga/rb-grn-utils.c b/ext/groonga/rb-grn-utils.c index d9eb5e4e..adf21bac 100644 --- a/ext/groonga/rb-grn-utils.c +++ b/ext/groonga/rb-grn-utils.c @@ -171,6 +171,12 @@ rb_grn_equal_string (const char *string1, const char *string2) return strcmp(string1, string2) == 0; } +VALUE +rb_grn_convert_to_string (VALUE object) +{ + return rb_convert_type(object, RUBY_T_STRING, "String", "to_str"); +} + VALUE rb_grn_convert_to_array (VALUE object) { diff --git a/ext/groonga/rb-grn.h b/ext/groonga/rb-grn.h index 6c065cfe..dda3443c 100644 --- a/ext/groonga/rb-grn.h +++ b/ext/groonga/rb-grn.h @@ -359,6 +359,7 @@ grn_bool rb_grn_equal_option (VALUE option, const char *key); grn_bool rb_grn_equal_string (const char *string1, const char *string2); +VALUE rb_grn_convert_to_string (VALUE object); VALUE rb_grn_convert_to_array (VALUE object); VALUE rb_grn_check_convert_to_string (VALUE object); VALUE rb_grn_check_convert_to_array (VALUE object);