Class: Couchbase::Result
- Inherits:
-
Object
- Object
- Couchbase::Result
- Defined in:
- ext/couchbase_ext/couchbase_ext.c,
ext/couchbase_ext/couchbase_ext.c
Overview
The object which yielded to asynchronous callbacks
Instance Attribute Summary collapse
- #cas ⇒ Fixnum readonly
- #error ⇒ Couchbase::Error::Base readonly
- #flags ⇒ Fixnum readonly
- #key ⇒ String readonly
- #node ⇒ String readonly
- #operation ⇒ Symbol readonly
- #value ⇒ String readonly
Instance Method Summary collapse
-
#inspect ⇒ String
Returns a string containing a human-readable representation of the Result.
-
#success? ⇒ Boolean
Check if result of operation was successful.
Instance Attribute Details
#cas ⇒ Fixnum (readonly)
#error ⇒ Couchbase::Error::Base (readonly)
#flags ⇒ Fixnum (readonly)
#key ⇒ String (readonly)
#node ⇒ String (readonly)
#operation ⇒ Symbol (readonly)
#value ⇒ String (readonly)
Instance Method Details
#inspect ⇒ String
Returns a string containing a human-readable representation of the Result.
3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 |
# File 'ext/couchbase_ext/couchbase_ext.c', line 3066
static VALUE
cb_result_inspect(VALUE self)
{
VALUE str, attr, error;
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_ivar_get(self, id_iv_error);
if (RTEST(attr)) {
error = rb_ivar_get(attr, id_iv_error);
} else {
error = INT2FIX(0);
}
rb_str_buf_cat2(str, " error=0x");
rb_str_append(str, rb_funcall(error, id_to_s, 1, INT2FIX(16)));
attr = rb_ivar_get(self, id_iv_key);
if (RTEST(attr)) {
rb_str_buf_cat2(str, " key=");
rb_str_append(str, rb_inspect(attr));
}
attr = rb_ivar_get(self, id_iv_cas);
if (RTEST(attr)) {
rb_str_buf_cat2(str, " cas=");
rb_str_append(str, rb_inspect(attr));
}
attr = rb_ivar_get(self, id_iv_flags);
if (RTEST(attr)) {
rb_str_buf_cat2(str, " flags=0x");
rb_str_append(str, rb_funcall(attr, id_to_s, 1, INT2FIX(16)));
}
attr = rb_ivar_get(self, id_iv_node);
if (RTEST(attr)) {
rb_str_buf_cat2(str, " node=");
rb_str_append(str, rb_inspect(attr));
}
rb_str_buf_cat2(str, ">");
return str;
}
|
#success? ⇒ Boolean
Check if result of operation was successful.
3055 3056 3057 3058 3059 |
# File 'ext/couchbase_ext/couchbase_ext.c', line 3055
static VALUE
cb_result_success_p(VALUE self)
{
return RTEST(rb_ivar_get(self, id_iv_error)) ? Qfalse : Qtrue;
}
|