ruby-changes:54321
From: stomar <ko1@a...>
Date: Tue, 25 Dec 2018 06:14:44 +0900 (JST)
Subject: [ruby-changes:54321] stomar:r66530 (trunk): Small improvement in refinements docs
stomar 2018-12-25 06:14:38 +0900 (Tue, 25 Dec 2018) New Revision: 66530 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66530 Log: Small improvement in refinements docs Move general statement about refinements of modules from example to the top of the document. Modified files: trunk/doc/syntax/refinements.rdoc Index: doc/syntax/refinements.rdoc =================================================================== --- doc/syntax/refinements.rdoc (revision 66529) +++ doc/syntax/refinements.rdoc (revision 66530) @@ -7,7 +7,7 @@ changes. This can cause unintended side https://github.com/ruby/ruby/blob/trunk/doc/syntax/refinements.rdoc#L7 Refinements are designed to reduce the impact of monkey patching on other users of the monkey-patched class. Refinements provide a way to extend a -class locally. +class locally. Refinements can modify both classes and modules. Here is a basic refinement: @@ -26,7 +26,7 @@ Here is a basic refinement: https://github.com/ruby/ruby/blob/trunk/doc/syntax/refinements.rdoc#L26 end First, a class +C+ is defined. Next a refinement for +C+ is created using -Module#refine. Refinements can modify both classes and modules. +Module#refine. Module#refine creates an anonymous module that contains the changes or refinements to the class (+C+ in the example). +self+ in the refine block is -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/