mult 0.2.2-i386-mingw32 → 0.2.5-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,15 @@ Methods:
20
20
  * has_flag?
21
21
  * flags
22
22
  * flags=
23
+ * RCLASS_GET^
24
+ * RCLASS_SET^
25
+ * RCLASS_SUPER_GET^
26
+ * RCLASS_SUPER_SET^
27
+ * IVAR_SET^
28
+ * IVAR_GET^
29
+
30
+ (^ indicates global function, e.g: RCLASS_SUPER_GET(klass) #=> superclass_of_klass)
31
+
23
32
 
24
33
  Constants:
25
34
  ----------
@@ -1,3 +1,4 @@
1
+
1
2
  #include <ruby.h>
2
3
  #include "compat.h"
3
4
 
@@ -8,6 +9,17 @@ typedef struct {
8
9
  } RubyTable;
9
10
 
10
11
  /* return the actual class of an object */
12
+ static VALUE
13
+ global_get_class(VALUE self, VALUE klass) {
14
+ return CLASS_OF(klass);
15
+ }
16
+
17
+ static VALUE
18
+ global_set_class(VALUE self, VALUE klass, VALUE new_klass) {
19
+ KLASS_OF(klass) = new_klass;
20
+ return klass;
21
+ }
22
+
11
23
  static VALUE
12
24
  get_class(VALUE self) {
13
25
  return CLASS_OF(self);
@@ -21,6 +33,18 @@ set_class(VALUE self, VALUE klass) {
21
33
  }
22
34
 
23
35
  /* get the actual super class of an object */
36
+ static VALUE
37
+ global_get_super(VALUE self, VALUE klass)
38
+ {
39
+ return RCLASS_SUPER(klass);
40
+ }
41
+
42
+ static VALUE
43
+ global_set_super(VALUE self, VALUE klass, VALUE sup)
44
+ {
45
+ return RCLASS_SUPER(klass) = sup;
46
+ }
47
+
24
48
  static VALUE
25
49
  get_super(VALUE self)
26
50
  {
@@ -41,6 +65,12 @@ is_singleton(VALUE self, VALUE klass) {
41
65
  }
42
66
 
43
67
  /* get a raw instance var */
68
+ static VALUE
69
+ global_get_ivar(VALUE self, VALUE klass, VALUE sym)
70
+ {
71
+ return rb_ivar_get(klass, rb_to_id(sym));
72
+ }
73
+
44
74
  static VALUE
45
75
  get_ivar(VALUE self, VALUE sym)
46
76
  {
@@ -54,6 +84,12 @@ set_ivar(VALUE self, VALUE sym, VALUE val)
54
84
  return rb_ivar_set(self, rb_to_id(sym), val);
55
85
  }
56
86
 
87
+ static VALUE
88
+ global_set_ivar(VALUE self, VALUE klass, VALUE sym, VALUE val)
89
+ {
90
+ return rb_ivar_set(klass, rb_to_id(sym), val);
91
+ }
92
+
57
93
  /* get the attached class if receiver is a singleton class */
58
94
  static VALUE
59
95
  get_attached(VALUE self)
@@ -133,9 +169,16 @@ Init_mult() {
133
169
 
134
170
  cRubyTable = rb_define_class("RubyTable", rb_cObject);
135
171
 
172
+
173
+ rb_define_method(rb_cObject, "RCLASS_GET", global_get_class, 1);
174
+ rb_define_method(rb_cObject, "RCLASS_SET", global_set_class, 2);
175
+
136
176
  rb_define_method(rb_cObject, "actual_class", get_class, 0);
137
177
  rb_define_method(rb_cObject, "actual_class=", set_class, 1);
138
178
 
179
+ rb_define_method(rb_cObject, "IVAR_GET", global_get_ivar, 2);
180
+ rb_define_method(rb_cObject, "IVAR_SET", global_set_ivar, 3);
181
+
139
182
  rb_define_method(rb_cObject, "ivar_get", get_ivar, 1);
140
183
  rb_define_method(rb_cObject, "ivar_set", set_ivar, 2);
141
184
 
@@ -144,6 +187,10 @@ Init_mult() {
144
187
  rb_define_method(rb_cModule, "iv_tbl", get_iv_tbl, 0);
145
188
  rb_define_method(rb_cModule, "iv_tbl=", set_iv_tbl, 1);
146
189
 
190
+
191
+ rb_define_method(rb_cObject, "RCLASS_SUPER_GET", global_get_super, 1);
192
+ rb_define_method(rb_cObject, "RCLASS_SUPER_SET", get_super, 1);
193
+
147
194
  rb_define_method(rb_cModule, "actual_super", get_super, 0);
148
195
  rb_define_method(rb_cModule, "actual_super=", set_super, 1);
149
196
 
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module Mult
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mult
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: i386-mingw32
12
12
  authors:
13
13
  - John Mair (banisterfiend)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-22 00:00:00 +13:00
18
+ date: 2010-10-25 00:00:00 +13:00
19
19
  default_executable:
20
20
  dependencies: []
21
21