/* * Inspects the table. * * @overload inspect * @return [String] the inspected string. */ static VALUE rb_grn_table_key_support_inspect (VALUE self) { VALUE inspected; inspected = rb_str_new2(""); rb_grn_object_inspect_header(self, inspected); rb_grn_object_inspect_content(self, inspected); rb_grn_table_inspect_content(self, inspected); rb_grn_table_key_support_inspect_content(self, inspected); rb_grn_object_inspect_footer(self, inspected); return inspected; }
static VALUE rb_grn_expression_inspect (VALUE self) { grn_ctx *context = NULL; grn_obj *expression; grn_obj inspected; VALUE rb_inspected; rb_grn_expression_deconstruct(SELF(self), &expression, &context, NULL, NULL, NULL, NULL, NULL); rb_inspected = rb_str_new_cstr(""); rb_grn_object_inspect_header(self, rb_inspected); GRN_TEXT_INIT(&inspected, 0); grn_inspect(context, &inspected, expression); grn_bulk_truncate(context, &inspected, GRN_TEXT_LEN(&inspected) - 2); { size_t prefix_length; const char *content; size_t content_length; prefix_length = strlen("#<expr"); content = GRN_TEXT_VALUE(&inspected) + prefix_length; content_length = GRN_TEXT_LEN(&inspected) - prefix_length; rb_str_concat(rb_inspected, rb_grn_context_rb_string_new(context, content, content_length)); } GRN_OBJ_FIN(context, &inspected); rb_grn_object_inspect_footer(self, rb_inspected); return rb_inspected; }