diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-03 08:35:44 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-03 08:35:44 +0000 |
commit | 476f9b638895f1550e75552c49ef169ef1adc008 (patch) | |
tree | 8727e27387f0e0030c712621c669b60554ee7c2a /doc/syntax/refinements.rdoc | |
parent | 3616b07c9aaafe49779d31bcd3e0d9ada6791777 (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
Diffstat (limited to 'doc/syntax/refinements.rdoc')
-rw-r--r-- | doc/syntax/refinements.rdoc | 23 |
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 |