public
Description: Bringing back the glory days of tabletop gaming
Homepage: http://rubydie.com/
Clone URL: git://github.com/elliottcable/rdie.git
* Spec'd out Classist a little. RCov is misleading, it's functionality and 
intent are nearly completely unspec'd
* Fixed up Classist to not run the hook twice
elliottcable (author)
Sat Apr 12 03:38:07 -0700 2008
commit  f2b23e5bd3251fa585ba18367d346b6fa4384e88
tree    7e69af426743f24bfbbefefd0ac6e9a701438ed0
parent  ca240e5227d182ad3a5c4b06aedc6e6c7d689e71
...
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
29
0
@@ -1,27 +1,28 @@
0
 module Classist
0
+
0
+ class ::Object
0
+ def self.inherited(klass)
0
+ return if klass.name == ''
0
+ ancestors = klass.name.split('::')
0
+
0
+ ancestors = ancestors.inject([Object.send(:const_get, ancestors.shift)]) do |acc, ancestor|
0
+ acc << acc.last.send(:const_get, ancestor)
0
+ end
0
+
0
+ classies = ancestors.reject{|a| !a.include? Classist}
0
+ classies.each do |classy|
0
+ classy.class_eval do
0
+ classize(klass)
0
+ end
0
+ end
0
+ nil
0
+ end
0
+ end
0
+
0
   ##
0
   # When included into a module or class Foo, this will cause any classes defined
0
   # within Foo to run the method Foo.classize(the_new_class). This module is
0
   # no more than a sort of placeholder, all the real magic happens in
0
   # Object.inherited.
0
   # TODO: Figure out a way to do this, without messing with Object
0
-end
0
-
0
-class Object
0
- def self.inherited(klass)
0
- return if klass.name == ''
0
- ancestors = klass.name.split('::')
0
-
0
- ancestors = ancestors.inject([Object.send(:const_get, ancestors.first)]) do |acc, ancestor|
0
- acc << acc.last.send(:const_get, ancestor)
0
- end
0
-
0
- classies = ancestors.reject{|a| !a.include? Classist}
0
- classies.each do |classy|
0
- classy.class_eval do
0
- classize(klass)
0
- end
0
- end
0
- nil
0
- end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.