mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									3616b07c9a
								
							
						
					
					
						commit
						476f9b6388
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 shugo
						shugo