retroactive_module_inclusion 1.0.1 → 1.0.2
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 +0 -0
- data/README.rdoc +3 -4
- data/Rakefile +11 -14
- data/test/test_retroactive_module_inclusion.rb +1 -2
- metadata +10 -13
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/README.rdoc
CHANGED
@@ -13,8 +13,8 @@ behaviour hurts the least surprise principle, specially because if K is a
|
|
13
13
|
class, then
|
14
14
|
K.class_eval { include M }
|
15
15
|
_does_ make all methods of M available to all classes which had previously
|
16
|
-
inherited it. This inconsistency stems from
|
17
|
-
|
16
|
+
inherited it. This inconsistency stems from efficienty concerns and characterize
|
17
|
+
a limitation in Ruby's object model (see {Dynamic Module Include Problem}[http://eigenclass.org/hiki/The+double+inclusion+problem]).
|
18
18
|
|
19
19
|
== AN EXAMPLE OF THE "DYNAMIC MODULE INCLUDE" PROBLEM
|
20
20
|
|
@@ -22,8 +22,7 @@ Let's begin by defining a one-method module:
|
|
22
22
|
|
23
23
|
module Stats
|
24
24
|
def mean
|
25
|
-
|
26
|
-
inject {|s,k| n += 1 ; s + k }.to_f / count
|
25
|
+
inject(&:+) / count.to_f
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
data/Rakefile
CHANGED
@@ -3,31 +3,28 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
5
|
|
6
|
-
# Hoe.plugin :compiler
|
7
|
-
# Hoe.plugin :cucumberfeatures
|
8
|
-
# Hoe.plugin :gem_prelude_sucks
|
9
|
-
# Hoe.plugin :inline
|
10
|
-
# Hoe.plugin :manifest
|
11
|
-
# Hoe.plugin :newgem
|
12
|
-
# Hoe.plugin :racc
|
13
|
-
# Hoe.plugin :rubyforge
|
14
6
|
# Hoe.plugin :website
|
15
7
|
|
16
8
|
Hoe.spec 'retroactive_module_inclusion' do
|
17
|
-
# HEY! If you fill these out in ~/.hoe_template/Rakefile.erb then
|
18
|
-
# you'll never have to touch them again!
|
19
|
-
# (delete this comment too, of course)
|
20
|
-
|
21
9
|
developer('Adriano Mitre', 'adriano.mitre@gmail.com')
|
22
10
|
|
23
|
-
self.version = '1.0.
|
11
|
+
self.version = '1.0.2'
|
24
12
|
|
25
13
|
self.readme_file = 'README.rdoc'
|
26
14
|
self.history_file = 'History.rdoc'
|
27
15
|
self.extra_rdoc_files += ['README.rdoc', 'History.rdoc']
|
28
16
|
self.extra_rdoc_files << ['Wishlist.rdoc'] if File.exist? 'Wishlist.rdoc'
|
29
17
|
|
30
|
-
|
18
|
+
self.description = <<EOS
|
19
|
+
This gem circumvents the "dynamic module include" (aka "double inclusion")
|
20
|
+
problem, which is the fact that M.module_eval { include N } does not make
|
21
|
+
the methods of module N available to modules and classes which had included
|
22
|
+
module M beforehand, only to the ones that include it thereafter. This
|
23
|
+
behaviour hurts the least surprise principle, specially because if K is a
|
24
|
+
class, then K.class_eval { include M } *does* make all methods of M available
|
25
|
+
to all classes which had previously inherited it.
|
26
|
+
EOS
|
27
|
+
|
31
28
|
end
|
32
29
|
|
33
30
|
# vim: syntax=ruby
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adriano Mitre
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
9u8N6mQNneIVRh6Xfdko/Q==
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2011-01-
|
38
|
+
date: 2011-01-21 00:00:00 -02:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -53,18 +53,15 @@ dependencies:
|
|
53
53
|
version: 2.8.0
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id001
|
56
|
-
description:
|
56
|
+
description: |
|
57
57
|
This gem circumvents the "dynamic module include" (aka "double inclusion")
|
58
|
-
problem, which is the fact that
|
59
|
-
|
60
|
-
|
61
|
-
included module M beforehand, only to the ones that include it thereafter. This
|
58
|
+
problem, which is the fact that M.module_eval { include N } does not make
|
59
|
+
the methods of module N available to modules and classes which had included
|
60
|
+
module M beforehand, only to the ones that include it thereafter. This
|
62
61
|
behaviour hurts the least surprise principle, specially because if K is a
|
63
|
-
class, then
|
64
|
-
|
65
|
-
|
66
|
-
inherited it. This inconsistency stems from implementation efficienty concerns
|
67
|
-
and characterize a limitation in Ruby's object model (see {Dynamic Module Include Problem}[http://eigenclass.org/hiki/The+double+inclusion+problem]).
|
62
|
+
class, then K.class_eval { include M } *does* make all methods of M available
|
63
|
+
to all classes which had previously inherited it.
|
64
|
+
|
68
65
|
email:
|
69
66
|
- adriano.mitre@gmail.com
|
70
67
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|