Added UUID support in Ruby library
diff --git a/lib/rb/ext/struct.c b/lib/rb/ext/struct.c
index ad33a81..c36c161 100644
--- a/lib/rb/ext/struct.c
+++ b/lib/rb/ext/struct.c
@@ -75,6 +75,11 @@
return Qnil;
}
+VALUE default_write_uuid(VALUE protocol, VALUE value) {
+ rb_funcall(protocol, write_uuid_method_id, 1, value);
+ return Qnil;
+}
+
VALUE default_write_binary(VALUE protocol, VALUE value) {
rb_funcall(protocol, write_binary_method_id, 1, value);
return Qnil;
@@ -195,6 +200,10 @@
return rb_funcall(protocol, read_string_method_id, 0);
}
+VALUE default_read_uuid(VALUE protocol) {
+ return rb_funcall(protocol, read_uuid_method_id, 0);
+}
+
VALUE default_read_binary(VALUE protocol) {
return rb_funcall(protocol, read_binary_method_id, 0);
}
@@ -342,6 +351,8 @@
} else {
default_write_binary(protocol, value);
}
+ } else if (ttype == TTYPE_UUID) {
+ default_write_uuid(protocol, value);
} else if (IS_CONTAINER(ttype)) {
write_container(ttype, field_info, value, protocol);
} else if (ttype == TTYPE_STRUCT) {
@@ -452,6 +463,8 @@
}
} else if (ttype == TTYPE_DOUBLE) {
result = default_read_double(protocol);
+ } else if (ttype == TTYPE_UUID) {
+ result = default_read_uuid(protocol);
} else if (ttype == TTYPE_STRUCT) {
VALUE klass = rb_hash_aref(field_info, class_sym);
result = rb_class_new_instance(0, NULL, klass);