glib2 2.2.5 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2015 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgprivate.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cVariant
24
+
25
+ #define _SELF(s) (DATA_PTR(s))
26
+
27
+ static VALUE RG_TARGET_NAMESPACE;
28
+
29
+ VALUE
30
+ rbg_variant_to_ruby(GVariant *variant)
31
+ {
32
+ const GVariantType *type;
33
+
34
+ if (!variant) {
35
+ return Qnil;
36
+ }
37
+
38
+ type = g_variant_get_type(variant);
39
+
40
+ if (g_variant_type_equal(type, G_VARIANT_TYPE_BOOLEAN)) {
41
+ return CBOOL2RVAL(g_variant_get_boolean(variant));
42
+ } else if (g_variant_type_equal(type, G_VARIANT_TYPE_STRING)) {
43
+ const gchar *string;
44
+ gsize string_length;
45
+ string = g_variant_get_string(variant, &string_length);
46
+ return CSTR2RVAL_LEN(string, string_length);
47
+ } else {
48
+ rb_raise(rb_eNotImpError,
49
+ "TODO: GVariant(%.*s) -> Ruby",
50
+ (int)g_variant_type_get_string_length(type),
51
+ g_variant_type_peek_string(type));
52
+ }
53
+
54
+ return Qnil;
55
+ }
56
+
57
+ GVariant *
58
+ rbg_variant_from_ruby(VALUE rb_variant)
59
+ {
60
+ if (NIL_P(rb_variant)) {
61
+ return NULL;
62
+ } else {
63
+ return _SELF(rb_variant);
64
+ }
65
+ }
66
+
67
+ static void
68
+ rg_variant_free(gpointer object)
69
+ {
70
+ GVariant *variant = object;
71
+
72
+ g_variant_unref(variant);
73
+ }
74
+
75
+ static VALUE
76
+ rg_variant_allocate(VALUE klass)
77
+ {
78
+ return Data_Wrap_Struct(klass, NULL, rg_variant_free, NULL);
79
+ }
80
+
81
+ static VALUE
82
+ rg_initialize(VALUE self, VALUE rb_value)
83
+ {
84
+ GVariant *variant;
85
+
86
+ switch (rb_type(rb_value)) {
87
+ case RUBY_T_STRING:
88
+ variant = g_variant_new_string(RVAL2CSTR(rb_value));
89
+ break;
90
+ default:
91
+ rb_raise(rb_eNotImpError,
92
+ "TODO: Ruby -> GVariant: %s",
93
+ RBG_INSPECT(rb_value));
94
+ break;
95
+ }
96
+ g_variant_ref_sink(variant);
97
+ DATA_PTR(self) = variant;
98
+
99
+ return Qnil;
100
+ }
101
+
102
+ static VALUE
103
+ rg_value(VALUE self)
104
+ {
105
+ GVariant *variant;
106
+
107
+ variant = _SELF(self);
108
+
109
+ return rbg_variant_to_ruby(variant);
110
+ }
111
+
112
+ static VALUE
113
+ rg_type(VALUE self)
114
+ {
115
+ GVariant *variant;
116
+
117
+ variant = _SELF(self);
118
+
119
+ return GVARIANTTYPE2RVAL((GVariantType *)g_variant_get_type(variant));
120
+ }
121
+
122
+ void
123
+ Init_glib_variant(void)
124
+ {
125
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VARIANT, "Variant", mGLib);
126
+
127
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, rg_variant_allocate);
128
+
129
+ RG_DEF_METHOD(initialize, 1);
130
+ RG_DEF_METHOD(value, 0);
131
+ RG_DEF_METHOD(type, 0);
132
+ }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2015 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002,2003 Masahiro Sakai
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -34,6 +34,19 @@ rbg_rval2cstr(VALUE *str)
34
34
  {
35
35
  StringValue(*str);
36
36
 
37
+ #ifdef HAVE_RUBY_ENCODING_H
38
+ if (rb_enc_get(*str) != rb_utf8_encoding())
39
+ *str = rb_str_export_to_enc(*str, rb_utf8_encoding());
40
+ #endif
41
+
42
+ return StringValueCStr(*str);
43
+ }
44
+
45
+ const gchar *
46
+ rbg_rval2cstr_ptr(VALUE *str)
47
+ {
48
+ StringValue(*str);
49
+
37
50
  #ifdef HAVE_RUBY_ENCODING_H
38
51
  if (rb_enc_get(*str) != rb_utf8_encoding())
39
52
  *str = rb_str_export_to_enc(*str, rb_utf8_encoding());
@@ -1155,4 +1168,6 @@ union GDoubleIEEE754;
1155
1168
  Init_glib_unichar();
1156
1169
  Init_glib_keyfile();
1157
1170
  Init_glib_bookmark_file();
1171
+ Init_glib_variant_type();
1172
+ Init_glib_variant();
1158
1173
  }
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2005 Ruby-GNOME2 Project
3
+ * Copyright (C) 2002-2015 Ruby-GNOME2 Project Team
5
4
  * Copyright (C) 2002,2003 Masahiro Sakai
6
5
  *
7
6
  * This library is free software; you can redistribute it and/or
@@ -21,6 +20,7 @@
21
20
  */
22
21
 
23
22
  #include <glib-object.h>
23
+ #include "glib-enum-types.h"
24
24
 
25
25
  #include "ruby.h"
26
26
 
@@ -34,9 +34,9 @@
34
34
  extern "C" {
35
35
  #endif /* __cplusplus */
36
36
 
37
- #define RBGLIB_MAJOR_VERSION 2
38
- #define RBGLIB_MINOR_VERSION 2
39
- #define RBGLIB_MICRO_VERSION 5
37
+ #define RBGLIB_MAJOR_VERSION 3
38
+ #define RBGLIB_MINOR_VERSION 0
39
+ #define RBGLIB_MICRO_VERSION 1
40
40
 
41
41
  #ifndef RSTRING_PTR
42
42
  # define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -44,8 +44,12 @@ extern "C" {
44
44
  #endif
45
45
 
46
46
  #ifndef RARRAY_PTR
47
- # define RARRAY_PTR(s) (RARRAY(s)->ptr)
48
- # define RARRAY_LEN(s) (RARRAY(s)->len)
47
+ # define RARRAY_PTR(a) (RARRAY(a)->ptr)
48
+ # define RARRAY_LEN(a) (RARRAY(a)->len)
49
+ #endif
50
+
51
+ #ifndef RARRAY_CONST_PTR
52
+ # define RARRAY_CONST_PTR(a) RARRAY_PTR(a)
49
53
  #endif
50
54
 
51
55
  #ifndef DBL2NUM
@@ -67,6 +71,7 @@ extern "C" {
67
71
  #define RBG_INSPECT(object) (rbg_rval_inspect(object))
68
72
 
69
73
  #define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
74
+ #define RVAL2CSTR_PTR(v) (rbg_rval2cstr_ptr(&(v)))
70
75
  #define RVAL2CSTR_ACCEPT_NIL(v) (rbg_rval2cstr_accept_nil(&(v)))
71
76
  #define RVAL2CSTR2(v) (RVAL2CSTR_ACCEPT_NIL(v))
72
77
  #define RVAL2CSTR_ACCEPT_SYMBOL(v) (rbg_rval2cstr_accept_symbol(&(v)))
@@ -142,6 +147,7 @@ extern const gchar *rbg_rval_inspect(VALUE object);
142
147
 
143
148
  extern gchar* rbg_string_value_ptr(volatile VALUE* ptr); /* no longer used */
144
149
  extern const gchar *rbg_rval2cstr(VALUE *str);
150
+ extern const gchar *rbg_rval2cstr_ptr(VALUE *str);
145
151
  extern const gchar *rbg_rval2cstr_accept_nil(VALUE *str);
146
152
  extern const gchar *rbg_rval2cstr_accept_symbol(volatile VALUE *value);
147
153
  extern const gchar *rbg_rval2cstr_accept_symbol_accept_nil(volatile VALUE *value);
@@ -195,6 +201,11 @@ extern VALUE rbglib_uint64_to_num(guint64 val);
195
201
  extern gint64 rbglib_num_to_int64(VALUE val);
196
202
  extern guint64 rbglib_num_to_uint64(VALUE val);
197
203
 
204
+
205
+ extern VALUE rbg_variant_to_ruby(GVariant *variant);
206
+ extern GVariant *rbg_variant_from_ruby(VALUE rb_variant);
207
+
208
+
198
209
  #ifdef __cplusplus
199
210
  }
200
211
  #endif /* __cplusplus */
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2015 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -41,6 +41,8 @@
41
41
  #define GTIMER2RVAL(o) (BOXED2RVAL(o, G_TYPE_TIMER))
42
42
  #define RVAL2GVALUE(o) ((GValue*)RVAL2BOXED(o, G_TYPE_VALUE))
43
43
  #define GVALUE2RVAL(o) (BOXED2RVAL(o, G_TYPE_VALUE))
44
+ #define RVAL2GVARIANTTYPE(o) ((GVariantType *)RVAL2BOXED(o, G_TYPE_VARIANT_TYPE))
45
+ #define GVARIANTTYPE2RVAL(o) (BOXED2RVAL(o, G_TYPE_VARIANT_TYPE))
44
46
 
45
47
  #define RVAL2GIOCONDITION(o) (RVAL2GFLAGS(o, G_TYPE_IO_CONDITION))
46
48
  #define GIOCONDITION2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_IO_CONDITION))
@@ -54,4 +56,7 @@
54
56
 
55
57
  #define RVAL2GFORMATSIZEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_FORMAT_SIZE_FLAGS))
56
58
  #define GFORMATSIZEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_FORMAT_SIZE_FLAGS))
59
+
60
+ #define RVAL2GBINDINGFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_BINDING_FLAGS))
61
+ #define GBINDINGFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_BINDING_FLAGS))
57
62
  #endif /* __GLIB2CONVERSIONS_H__ */
@@ -53,7 +53,7 @@ void g_dir_close (GDir *dir);
53
53
  static VALUE
54
54
  rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size)
55
55
  {
56
- return CSTR2RVAL_FREE(g_format_size_for_display(NUM2INT(size)));
56
+ return CSTR2RVAL_FREE(g_format_size_for_display(NUM2ULONG(size)));
57
57
  }
58
58
  #endif
59
59
 
@@ -65,14 +65,14 @@ rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
65
65
 
66
66
  rb_scan_args(argc, argv, "11", &rb_size, &rb_options);
67
67
  if (NIL_P(rb_options)) {
68
- return CSTR2RVAL_FREE(g_format_size(NUM2UINT(rb_size)));
68
+ return CSTR2RVAL_FREE(g_format_size(NUM2ULONG(rb_size)));
69
69
  } else {
70
70
  VALUE rb_flags;
71
71
  rbg_scan_options(rb_options,
72
72
  "flags", &rb_flags,
73
73
  NULL);
74
74
 
75
- return CSTR2RVAL_FREE(g_format_size_full(NUM2UINT(rb_size),
75
+ return CSTR2RVAL_FREE(g_format_size_full(NUM2ULONG(rb_size),
76
76
  RVAL2GFORMATSIZEFLAGS(rb_flags)));
77
77
  }
78
78
  }
@@ -21,6 +21,10 @@
21
21
 
22
22
  #include "rbgprivate.h"
23
23
 
24
+ #ifdef HAVE_RUBY_THREAD_H
25
+ # include <ruby/thread.h>
26
+ #endif
27
+
24
28
  GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT;
25
29
 
26
30
  /*
@@ -32,6 +36,8 @@ static VALUE mGLibSource;
32
36
  static ID id__callbacks__;
33
37
  static GHashTable *callbacks_table;
34
38
 
39
+ static GThread *main_thread;
40
+
35
41
  typedef struct _callback_info_t
36
42
  {
37
43
  VALUE callback;
@@ -49,15 +55,29 @@ typedef struct _PollInfo
49
55
  gint result;
50
56
  } PollInfo;
51
57
 
58
+ static void
59
+ rg_poll_in_blocking_raw(PollInfo *info)
60
+ {
61
+ info->result = default_poll_func(info->ufds, info->nfsd, info->timeout);
62
+ }
63
+
64
+ #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
65
+ static void *
66
+ rg_poll_in_blocking(void *data)
67
+ {
68
+ PollInfo *info = data;
69
+ rg_poll_in_blocking_raw(info);
70
+ return NULL;
71
+ }
72
+ #else
52
73
  static VALUE
53
74
  rg_poll_in_blocking(void *data)
54
75
  {
55
76
  PollInfo *info = data;
56
-
57
- info->result = default_poll_func(info->ufds, info->nfsd, info->timeout);
58
-
77
+ rg_poll_in_blocking_raw(info);
59
78
  return Qnil;
60
79
  }
80
+ #endif
61
81
 
62
82
  static gint
63
83
  rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
@@ -70,11 +90,17 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
70
90
  info.result = 0;
71
91
 
72
92
  g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL);
93
+ if (g_thread_self() == main_thread) {
73
94
  #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
74
- rb_thread_call_without_gvl(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
95
+ rb_thread_call_without_gvl(rg_poll_in_blocking, &info,
96
+ RUBY_UBF_IO, NULL);
75
97
  #else
76
- rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
98
+ rb_thread_blocking_region(rg_poll_in_blocking, &info,
99
+ RUBY_UBF_IO, NULL);
77
100
  #endif
101
+ } else {
102
+ rg_poll_in_blocking_raw(&info);
103
+ }
78
104
  g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
79
105
 
80
106
  return info.result;
@@ -512,6 +538,10 @@ Init_glib_main_context(void)
512
538
  id__callbacks__ = rb_intern("__callbacks__");
513
539
  callbacks_table = g_hash_table_new(NULL, NULL);
514
540
 
541
+ g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
542
+
543
+ main_thread = g_thread_self();
544
+
515
545
  rbg_define_singleton_method(mGLib, "set_ruby_thread_priority",
516
546
  ruby_source_set_priority, 1);
517
547
 
@@ -0,0 +1,48 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2015 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgprivate.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cBinding
24
+
25
+ #define _SELF(object) G_BINDING(RVAL2GOBJ(self))
26
+
27
+ #if GLIB_CHECK_VERSION(2, 38, 0)
28
+ static VALUE
29
+ rg_unbind(VALUE self)
30
+ {
31
+ g_binding_unbind(_SELF(self));
32
+ return self;
33
+ }
34
+ #endif
35
+
36
+ void
37
+ Init_gobject_gbinding(void)
38
+ {
39
+ #if GLIB_CHECK_VERSION(2, 26, 0)
40
+ VALUE RG_TARGET_NAMESPACE;
41
+
42
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BINDING, "Binding", mGLib);
43
+ #endif
44
+
45
+ #if GLIB_CHECK_VERSION(2, 38, 0)
46
+ RG_DEF_METHOD(unbind, 0);
47
+ #endif
48
+ }
@@ -75,14 +75,18 @@ static VALUE
75
75
  rg_initialize(VALUE self)
76
76
  {
77
77
  VALUE rb_class;
78
+ gsize instance_size = 0;
78
79
 
79
80
  rb_class = CLASS_OF(self);
80
81
  if (RVAL2CBOOL(rb_ivar_defined(rb_class, rb_intern("@size")))) {
82
+ instance_size = NUM2UINT(rb_iv_get(rb_class, "@size"));
83
+ }
84
+
85
+ if (instance_size > 0) {
81
86
  const RGObjClassInfo *cinfo;
82
87
  gpointer instance;
83
- gsize instance_size;
88
+
84
89
  cinfo = rbgobj_lookup_class(rb_class);
85
- instance_size = NUM2UINT(rb_iv_get(rb_class, "@size"));
86
90
  instance = alloca(instance_size);
87
91
  memset(instance, 0, instance_size);
88
92
  G_INITIALIZE(self, g_boxed_copy(cinfo->gtype, instance));
@@ -29,6 +29,7 @@ VALUE RG_TARGET_NAMESPACE;
29
29
 
30
30
  static ID id_new;
31
31
  static ID id_to_s;
32
+ static ID id_to_i;
32
33
 
33
34
  /**********************************************************************/
34
35
 
@@ -270,20 +271,61 @@ enum_s_allocate(VALUE self)
270
271
  }
271
272
 
272
273
  static VALUE
273
- rg_initialize(VALUE self, VALUE arg)
274
+ rg_initialize(int argc, VALUE *argv, VALUE self)
274
275
  {
275
276
  enum_holder* p = enum_get_holder(self);
277
+ VALUE rb_value;
278
+ VALUE klass;
276
279
 
277
- if (rb_respond_to(arg, rb_intern("to_str"))) {
278
- const char* str = StringValuePtr(arg);
279
- p->info = g_enum_get_value_by_name(p->gclass, str);
280
- if (! p->info)
281
- p->info = g_enum_get_value_by_nick(p->gclass, str);
282
- if (! p->info)
283
- rb_raise(rb_eArgError, "invalid argument");
284
- } else {
285
- p->value = NUM2INT(arg);
286
- p->info = g_enum_get_value(p->gclass, p->value);
280
+ rb_scan_args(argc, argv, "01", &rb_value);
281
+
282
+ klass = CLASS_OF(self);
283
+
284
+ switch (TYPE(rb_value)) {
285
+ case RUBY_T_NIL:
286
+ p->value = 0;
287
+ break;
288
+ case RUBY_T_FIXNUM:
289
+ p->value = NUM2UINT(rb_value);
290
+ break;
291
+ case RUBY_T_STRING:
292
+ case RUBY_T_SYMBOL:
293
+ {
294
+ const gchar *name;
295
+
296
+ name = RVAL2CSTR_ACCEPT_SYMBOL(rb_value);
297
+ p->info = g_enum_get_value_by_name(p->gclass, name);
298
+ if (!p->info) {
299
+ gchar *nick;
300
+ nick = rbg_name_to_nick(name);
301
+ p->info = g_enum_get_value_by_nick(p->gclass, name);
302
+ g_free(nick);
303
+ }
304
+ if (!p->info) {
305
+ rb_raise(rb_eArgError, "unknown enum name: <%s>(%s)",
306
+ name,
307
+ g_type_name(G_TYPE_FROM_CLASS(p->gclass)));
308
+ }
309
+ p->value = p->info->value;
310
+ break;
311
+ }
312
+ default:
313
+ if (RVAL2CBOOL(rb_obj_is_kind_of(rb_value, klass))) {
314
+ p->value = NUM2INT(rb_funcall(rb_value, id_to_i, 0));
315
+ } else {
316
+ rb_raise(rb_eArgError,
317
+ "enum value must be one of "
318
+ "nil, Fixnum, String, Symbol o %s: "
319
+ "<%s>(%s)",
320
+ RBG_INSPECT(klass),
321
+ RBG_INSPECT(rb_value),
322
+ g_type_name(G_TYPE_FROM_CLASS(p->gclass)));
323
+ }
324
+ break;
325
+ }
326
+
327
+ if (!p->info) {
328
+ p->info = g_enum_get_value(p->gclass, p->value);
287
329
  }
288
330
 
289
331
  return Qnil;
@@ -374,6 +416,7 @@ Init_gobject_genums(void)
374
416
  {
375
417
  id_new = rb_intern("new");
376
418
  id_to_s = rb_intern("to_s");
419
+ id_to_i = rb_intern("to_i");
377
420
 
378
421
  RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_ENUM, "Enum", mGLib);
379
422
 
@@ -385,7 +428,7 @@ Init_gobject_genums(void)
385
428
 
386
429
  rb_define_alloc_func(RG_TARGET_NAMESPACE, enum_s_allocate);
387
430
 
388
- RG_DEF_METHOD(initialize, 1);
431
+ RG_DEF_METHOD(initialize, -1);
389
432
  RG_DEF_METHOD(to_i, 0);
390
433
  RG_DEF_METHOD(name, 0);
391
434
  RG_DEF_METHOD(nick, 0);