summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/-test-/typeddata/typeddata.c
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/-test-/typeddata/typeddata.c
Fresh start
Diffstat (limited to 'jni/ruby/ext/-test-/typeddata/typeddata.c')
-rw-r--r--jni/ruby/ext/-test-/typeddata/typeddata.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/jni/ruby/ext/-test-/typeddata/typeddata.c b/jni/ruby/ext/-test-/typeddata/typeddata.c
new file mode 100644
index 0000000..1c5d677
--- /dev/null
+++ b/jni/ruby/ext/-test-/typeddata/typeddata.c
@@ -0,0 +1,20 @@
+#include <ruby.h>
+
+static const rb_data_type_t test_data = {
+ "typed_data",
+};
+
+static VALUE
+test_check(VALUE self, VALUE obj)
+{
+ rb_check_typeddata(obj, &test_data);
+ return obj;
+}
+
+void
+Init_typeddata(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "TypedData", rb_cData);
+ rb_define_singleton_method(klass, "check", test_check, 1);
+}