Method: Couchbase::Result#inspect
- Defined in:
- ext/couchbase_ext/result.c
#inspect ⇒ String
Returns a string containing a human-readable representation of the Result.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'ext/couchbase_ext/result.c', line 41 VALUE cb_result_inspect(VALUE self) { VALUE str, attr; char buf[100]; str = rb_str_buf_new2("#<"); rb_str_buf_cat2(str, rb_obj_classname(self)); snprintf(buf, 100, ":%p", (void *)self); rb_str_buf_cat2(str, buf); attr = rb_attr_get(self, cb_id_iv_operation); if (RTEST(attr)) { rb_str_buf_cat2(str, " operation="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_error); if (RTEST(attr)) { rb_str_buf_cat2(str, " error="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_value); if (RTEST(attr) && RTEST(rb_obj_is_kind_of(attr, cb_cBucket))) { rb_str_buf_cat2(str, " bucket="); /* value also accessible using alias #bucket */ rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_key); if (RTEST(attr)) { rb_str_buf_cat2(str, " key="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_status); if (RTEST(attr)) { rb_str_buf_cat2(str, " status="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_cas); if (RTEST(attr)) { rb_str_buf_cat2(str, " cas="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_flags); if (RTEST(attr)) { rb_str_buf_cat2(str, " flags=0x"); rb_str_append(str, rb_funcall(attr, cb_id_to_s, 1, INT2FIX(16))); } attr = rb_attr_get(self, cb_id_iv_node); if (RTEST(attr)) { rb_str_buf_cat2(str, " node="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_from_master); if (attr != Qnil) { rb_str_buf_cat2(str, " from_master="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_time_to_persist); if (RTEST(attr)) { rb_str_buf_cat2(str, " time_to_persist="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_time_to_replicate); if (RTEST(attr)) { rb_str_buf_cat2(str, " time_to_replicate="); rb_str_append(str, rb_inspect(attr)); } attr = rb_attr_get(self, cb_id_iv_headers); if (RTEST(attr)) { rb_str_buf_cat2(str, " headers="); rb_str_append(str, rb_inspect(attr)); } rb_str_buf_cat2(str, ">"); return str; } |