[前][次][番号順一覧][スレッド一覧]

ruby-changes:54657

From: nobu <ko1@a...>
Date: Sun, 20 Jan 2019 13:38:58 +0900 (JST)
Subject: [ruby-changes:54657] nobu:r66873 (trunk): [DOC] Refactors documentation for `Forwardable`

nobu	2019-01-20 13:38:52 +0900 (Sun, 20 Jan 2019)

  New Revision: 66873

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66873

  Log:
    [DOC] Refactors documentation for `Forwardable`
    
    [ruby-core:71281] [Misc #11639]
    
    From: Sam Morgan <s_morgan@m...>

  Modified files:
    trunk/lib/forwardable.rb
Index: lib/forwardable.rb
===================================================================
--- lib/forwardable.rb	(revision 66872)
+++ lib/forwardable.rb	(revision 66873)
@@ -57,10 +57,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/forwardable.rb#L57
 #
 # == Another example
 #
-# We want to rely on what has come before obviously, but with delegation we can
-# take just the methods we need and even rename them as appropriate.  In many
-# cases this is preferable to inheritance, which gives us the entire old
-# interface, even if much of it isn't needed.
+# You could use Forwardable as an alternative to inheritance, when you don't want
+# to inherit all methods from the superclass. For instance, here is how you might
+# add a range of +Array+ instance methods to a new class +Queue+:
 #
 #   class Queue
 #     extend Forwardable

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]