object2module 0.4.3-i386-mswin32 → 0.4.5-i386-mswin32
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.
- data/README.markdown +2 -2
- data/Rakefile +40 -10
- data/ext/object2module/object2module.c +35 -1
- data/lib/1.8/object2module.so +0 -0
- data/lib/1.9/object2module.so +0 -0
- data/lib/object2module/version.rb +1 -1
- data/test/test_with_remix.rb +1 -0
- metadata +4 -4
data/README.markdown
CHANGED
@@ -56,12 +56,12 @@ Object2module simply removes the check for `T_MODULE` from `rb_include_module()`
|
|
56
56
|
Companion Libraries
|
57
57
|
--------------------
|
58
58
|
|
59
|
-
|
59
|
+
Object2module is one of a series of experimental libraries that mess with
|
60
60
|
the internals of Ruby to bring new and interesting functionality to
|
61
61
|
the language, see also:
|
62
62
|
|
63
63
|
* [Remix](http://github.com/banister/remix) - Makes ancestor chains read/write
|
64
|
-
* [
|
64
|
+
* [Include Complete](http://github.com/banister/include_complete) - Brings in
|
65
65
|
module singleton classes during an include. No more ugly ClassMethods and included() hook hacks.
|
66
66
|
* [Prepend](http://github.com/banister/prepend) - Prepends modules in front of a class; so method lookup starts with the module
|
67
67
|
* [GenEval](http://github.com/banister/gen_eval) - A strange new breed of instance_eval
|
data/Rakefile
CHANGED
@@ -7,9 +7,10 @@ require './lib/object2module/version.rb'
|
|
7
7
|
dlext = Config::CONFIG['DLEXT']
|
8
8
|
direc = File.dirname(__FILE__)
|
9
9
|
|
10
|
-
CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
|
11
10
|
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
|
12
|
-
|
11
|
+
CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~",
|
12
|
+
"ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
|
13
|
+
|
13
14
|
def apply_spec_defaults(s)
|
14
15
|
s.name = "object2module"
|
15
16
|
s.summary = "object2module enables ruby classes and objects to be used as modules"
|
@@ -21,9 +22,9 @@ def apply_spec_defaults(s)
|
|
21
22
|
s.date = Time.now.strftime '%Y-%m-%d'
|
22
23
|
s.require_path = 'lib'
|
23
24
|
s.homepage = "http://banisterfiend.wordpress.com"
|
24
|
-
s.files =
|
25
|
+
s.files = Dir["Rakefile", "README.markdown", "LICENSE",
|
25
26
|
"lib/**/*.rb", "test/**/*.rb", "ext/**/extconf.rb",
|
26
|
-
"ext/**/*.h", "ext/**/*.c"]
|
27
|
+
"ext/**/*.h", "ext/**/*.c"]
|
27
28
|
|
28
29
|
end
|
29
30
|
|
@@ -32,23 +33,21 @@ task :test do
|
|
32
33
|
end
|
33
34
|
|
34
35
|
[:mingw32, :mswin32].each do |v|
|
35
|
-
|
36
|
+
namespace v do
|
36
37
|
spec = Gem::Specification.new do |s|
|
37
38
|
apply_spec_defaults(s)
|
38
39
|
s.platform = "i386-#{v}"
|
39
|
-
s.files +=
|
40
|
+
s.files += Dir["lib/**/*.#{dlext}"]
|
40
41
|
end
|
41
42
|
|
42
43
|
Rake::GemPackageTask.new(spec) do |pkg|
|
43
44
|
pkg.need_zip = false
|
44
45
|
pkg.need_tar = false
|
45
46
|
end
|
46
|
-
|
47
|
-
Rake::Task[:gem].invoke
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
|
-
|
50
|
+
namespace :ruby do
|
52
51
|
spec = Gem::Specification.new do |s|
|
53
52
|
apply_spec_defaults(s)
|
54
53
|
s.platform = Gem::Platform::RUBY
|
@@ -59,7 +58,38 @@ task :ruby do
|
|
59
58
|
pkg.need_zip = false
|
60
59
|
pkg.need_tar = false
|
61
60
|
end
|
61
|
+
end
|
62
62
|
|
63
|
-
|
63
|
+
desc "build the 1.8 and 1.9 binaries from source and copy to lib/"
|
64
|
+
task :compile do
|
65
|
+
build_for = proc do |pik_ver, ver|
|
66
|
+
sh %{ \
|
67
|
+
c:\\devkit\\devkitvars.bat && \
|
68
|
+
pik #{pik_ver} && \
|
69
|
+
ruby extconf.rb && \
|
70
|
+
make clean && \
|
71
|
+
make && \
|
72
|
+
cp *.so #{direc}/lib/#{ver} \
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
chdir("#{direc}/ext/object2module") do
|
77
|
+
build_for.call("187", "1.8")
|
78
|
+
build_for.call("192", "1.9")
|
79
|
+
end
|
64
80
|
end
|
65
81
|
|
82
|
+
desc "build all platform gems at once"
|
83
|
+
task :gems => [:rmgems, "mingw32:gem", "mswin32:gem", "ruby:gem"]
|
84
|
+
|
85
|
+
desc "remove all platform gems"
|
86
|
+
task :rmgems => ["ruby:clobber_package"]
|
87
|
+
|
88
|
+
desc "build and push latest gems"
|
89
|
+
task :pushgems => :gems do
|
90
|
+
chdir("#{direc}/pkg") do
|
91
|
+
Dir["*.gem"].each do |gemfile|
|
92
|
+
sh "gem push #{gemfile}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -6,6 +6,37 @@
|
|
6
6
|
#include <ruby.h>
|
7
7
|
#include "compat.h"
|
8
8
|
|
9
|
+
static VALUE
|
10
|
+
class_to_s(VALUE self)
|
11
|
+
{
|
12
|
+
if (!rb_obj_is_kind_of(self, rb_cModule) || self == Qnil)
|
13
|
+
return rb_str_new2("Anon");
|
14
|
+
|
15
|
+
VALUE attached = rb_iv_get(self, "__attached__");
|
16
|
+
VALUE name;
|
17
|
+
|
18
|
+
if (attached) {
|
19
|
+
VALUE val = rb_iv_get(attached, "__module__");
|
20
|
+
if (NIL_P(val))
|
21
|
+
return rb_str_new2("Anon");
|
22
|
+
|
23
|
+
name = rb_mod_name(val);
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
VALUE val = rb_iv_get(attached, "__module__");
|
27
|
+
if (NIL_P(val))
|
28
|
+
return rb_str_new2("Anon");
|
29
|
+
|
30
|
+
name = rb_mod_name(val);
|
31
|
+
}
|
32
|
+
|
33
|
+
/* if module does not have a name, return "Anon" */
|
34
|
+
if (NIL_P(name) || RSTRING_LEN(name) == 0)
|
35
|
+
return rb_str_new2("Anon");
|
36
|
+
else
|
37
|
+
return name;
|
38
|
+
}
|
39
|
+
|
9
40
|
static VALUE
|
10
41
|
include_class_new(VALUE module, VALUE super)
|
11
42
|
{
|
@@ -13,13 +44,16 @@ include_class_new(VALUE module, VALUE super)
|
|
13
44
|
|
14
45
|
if (BUILTIN_TYPE(module) == T_ICLASS) {
|
15
46
|
|
16
|
-
/* for
|
47
|
+
/* for include_complete compat */
|
17
48
|
if (!NIL_P(rb_iv_get(module, "__module__")))
|
18
49
|
module = rb_iv_get(module, "__module__");
|
19
50
|
else
|
20
51
|
module = RBASIC(module)->klass;
|
21
52
|
}
|
22
53
|
|
54
|
+
rb_define_singleton_method(module, "to_s", class_to_s, 0);
|
55
|
+
rb_define_method(module, "to_s", class_to_s, 0);
|
56
|
+
|
23
57
|
if (!RCLASS_IV_TBL(module)) {
|
24
58
|
RCLASS_IV_TBL(module) = st_init_numtable();
|
25
59
|
}
|
data/lib/1.8/object2module.so
CHANGED
Binary file
|
data/lib/1.9/object2module.so
CHANGED
Binary file
|
data/test/test_with_remix.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 5
|
9
|
+
version: 0.4.5
|
10
10
|
platform: i386-mswin32
|
11
11
|
authors:
|
12
12
|
- John Mair (banisterfiend)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-16 00:00:00 +13:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -41,7 +41,7 @@ files:
|
|
41
41
|
- ext/object2module/object2module.c
|
42
42
|
- lib/1.8/object2module.so
|
43
43
|
- lib/1.9/object2module.so
|
44
|
-
has_rdoc:
|
44
|
+
has_rdoc: true
|
45
45
|
homepage: http://banisterfiend.wordpress.com
|
46
46
|
licenses: []
|
47
47
|
|