summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-03 08:35:44 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-03 08:35:44 +0000
commit476f9b638895f1550e75552c49ef169ef1adc008 (patch)
tree8727e27387f0e0030c712621c669b60554ee7c2a
parent3616b07c9aaafe49779d31bcd3e0d9ada6791777 (diff)
Specify refinement inheritance by Module#include.
[ruby-core:79880] [Bug #13271] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--doc/syntax/refinements.rdoc23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/syntax/refinements.rdoc b/doc/syntax/refinements.rdoc
index d57080686a..5519c47c37 100644
--- a/doc/syntax/refinements.rdoc
+++ b/doc/syntax/refinements.rdoc
@@ -256,6 +256,29 @@ method lookup.
This behavior may be changed in the future.
+== Refinement inheritance by Module#include
+
+When a module X is included into a module Y, Y inherits refinments from X.
+
+For exmaple, C inherits refinements from A and B in the following code:
+
+ module A
+ refine X do ... end
+ refine Y do ... end
+ end
+ module B
+ refine Z do ... end
+ end
+ module C
+ include A
+ include B
+ end
+
+ using C
+ # Refinements in A and B are activated here.
+
+Refinements in descendents have higher precedence than those of ancestors.
+
== Further Reading
See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/RefinementsSpec for the