mult 0.2.2 → 0.2.5

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.
Files changed (3) hide show
  1. data/ext/mult/mult.c +47 -0
  2. data/lib/mult/version.rb +1 -1
  3. metadata +4 -7
@@ -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
 
@@ -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,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mult
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 2
9
- - 2
10
- version: 0.2.2
8
+ - 5
9
+ version: 0.2.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - John Mair (banisterfiend)
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-22 00:00:00 +13:00
17
+ date: 2010-10-25 00:00:00 +13:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -36,7 +35,7 @@ files:
36
35
  - ext/mult/extconf.rb
37
36
  - ext/mult/compat.h
38
37
  - ext/mult/mult.c
39
- has_rdoc: yard
38
+ has_rdoc: true
40
39
  homepage: http://banisterfiend.wordpress.com
41
40
  licenses: []
42
41
 
@@ -50,7 +49,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
49
  requirements:
51
50
  - - ">="
52
51
  - !ruby/object:Gem::Version
53
- hash: 3
54
52
  segments:
55
53
  - 0
56
54
  version: "0"
@@ -59,7 +57,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
57
  requirements:
60
58
  - - ">="
61
59
  - !ruby/object:Gem::Version
62
- hash: 3
63
60
  segments:
64
61
  - 0
65
62
  version: "0"