retroactive_module_inclusion 1.0.0 → 1.0.1

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.tar.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.0.1 / 2011-01-20
2
+
3
+ * 1 minor enhancement
4
+
5
+ * Forced documentation of private method retroactively_include
6
+
1
7
  === 1.0.0 / 2011-01-19
2
8
 
3
9
  * 1 major enhancement
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Hoe.spec 'retroactive_module_inclusion' do
20
20
 
21
21
  developer('Adriano Mitre', 'adriano.mitre@gmail.com')
22
22
 
23
- self.version = '1.0.0'
23
+ self.version = '1.0.1'
24
24
 
25
25
  self.readme_file = 'README.rdoc'
26
26
  self.history_file = 'History.rdoc'
@@ -2,7 +2,23 @@ class Module
2
2
 
3
3
  private
4
4
 
5
- def retroactively_include(mod)
5
+ # Includes +mod+ retroactively, i.e., extending to all classes and modules which
6
+ # included +self+ _beforehand_.
7
+ #
8
+ # Example:
9
+ #
10
+ # module Stats
11
+ # def mean
12
+ # n = 1
13
+ # inject {|s,k| n += 1 ; s + k }.to_f / count
14
+ # end
15
+ # end
16
+ #
17
+ # Enumerable.module_eval { retroactively_include Stats }
18
+ #
19
+ # (1..2).mean #=> 1.5
20
+ #
21
+ def retroactively_include(mod) # :doc:
6
22
  raise TypeError, 'wrong argument type #{mod.class} (expected Module)' unless mod.is_a? Module
7
23
 
8
24
  # Although one would expect +A.module_eval("include B")+ to make methods
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adriano Mitre
metadata.gz.sig CHANGED
Binary file