public
Fork of halorgium/mephisto
Description: A refactored Mephisto that has multiple spam detection engines.
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/francois/mephisto.git
move Module.include_into into aaa so other plugins can use it
technoweenie (author)
Sun Feb 03 10:02:38 -0800 2008
commit  08e831d1c9bf302524559c0cb019e9cd5ad0c33b
tree    0358a5445102bc3b2275760ab2fd83d4c0f72309
parent  13c8aab7b6d4501731ed95b27cfdaf5cb346af80
...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
13
14
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
17
18
0
@@ -13,42 +13,6 @@ Symbol.class_eval do
0
   end
0
 end
0
 
0
-Module.class_eval do
0
- # A hash that maps Class names to an array of Modules to mix in when the class is instantiated.
0
- @@class_mixins = {}
0
- mattr_reader :class_mixins
0
-
0
- # Specifies that this module should be included into the given classes when they are instantiated.
0
- #
0
- # module FooMethods
0
- # include_into "Foo", "Bar"
0
- # end
0
- def include_into(*klasses)
0
- klasses.flatten!
0
- klasses.each do |klass|
0
- (@@class_mixins[klass] ||= []) << self
0
- @@class_mixins[klass].uniq!
0
- end
0
- end
0
-
0
- # add any class mixins that have been registered for this class
0
- def auto_include!
0
- mixins = @@class_mixins[name]
0
- send(:include, *mixins) if mixins
0
- end
0
-end
0
-
0
-Class.class_eval do
0
- # Instantiates a class and adds in any class_mixins that have been registered for it.
0
- def inherited_with_mixins(klass)
0
- returning inherited_without_mixins(klass) do |value|
0
- klass.auto_include!
0
- end
0
- end
0
-
0
- alias_method_chain :inherited, :mixins
0
-end
0
-
0
 # http://rails.techno-weenie.net/tip/2005/12/23/make_fixtures
0
 ActiveRecord::Base.class_eval do
0
   # person.dom_id #-> "person-5"
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
...
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
30
31
32
33
34
35
36
37
38
39
40
0
@@ -1,2 +1,38 @@
0
 # temporarily load this before all other plugins
0
-::Object::RAILS_PATH = Pathname.new(File.expand_path(RAILS_ROOT))
0
\ No newline at end of file
0
+::Object::RAILS_PATH = Pathname.new(File.expand_path(RAILS_ROOT))
0
+
0
+Module.class_eval do
0
+ # A hash that maps Class names to an array of Modules to mix in when the class is instantiated.
0
+ @@class_mixins = {}
0
+ mattr_reader :class_mixins
0
+
0
+ # Specifies that this module should be included into the given classes when they are instantiated.
0
+ #
0
+ # module FooMethods
0
+ # include_into "Foo", "Bar"
0
+ # end
0
+ def include_into(*klasses)
0
+ klasses.flatten!
0
+ klasses.each do |klass|
0
+ (@@class_mixins[klass] ||= []) << name.to_s
0
+ @@class_mixins[klass].uniq!
0
+ end
0
+ end
0
+
0
+ # add any class mixins that have been registered for this class
0
+ def auto_include!
0
+ mixins = @@class_mixins[name]
0
+ send(:include, *mixins.collect { |name| name.constantize }) if mixins
0
+ end
0
+end
0
+
0
+Class.class_eval do
0
+ # Instantiates a class and adds in any class_mixins that have been registered for it.
0
+ def inherited_with_mixins(klass)
0
+ returning inherited_without_mixins(klass) do |value|
0
+ klass.auto_include!
0
+ end
0
+ end
0
+
0
+ alias_method_chain :inherited, :mixins
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.