ruby-changes:48874
From: shugo <ko1@a...>
Date: Sun, 3 Dec 2017 17:35:49 +0900 (JST)
Subject: [ruby-changes:48874] shugo:r60992 (trunk): Specify refinement inheritance by Module#include.
shugo 2017-12-03 17:35:44 +0900 (Sun, 03 Dec 2017) New Revision: 60992 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60992 Log: Specify refinement inheritance by Module#include. [ruby-core:79880] [Bug #13271] Modified files: trunk/doc/syntax/refinements.rdoc Index: doc/syntax/refinements.rdoc =================================================================== --- doc/syntax/refinements.rdoc (revision 60991) +++ doc/syntax/refinements.rdoc (revision 60992) @@ -256,6 +256,29 @@ method lookup. https://github.com/ruby/ruby/blob/trunk/doc/syntax/refinements.rdoc#L256 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/