Skip to content

Commit

Permalink
Merge pull request #83 from ranguba/add-convert-to-string
Browse files Browse the repository at this point in the history
Add utility function which converts to string
  • Loading branch information
kou committed Apr 3, 2015
2 parents 63488a9 + d9805b1 commit 74fdf75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/groonga/rb-grn-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions ext/groonga/rb-grn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 74fdf75

Please sign in to comment.