summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 04:38:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 04:38:52 +0000
commit141ed2f6409184412b57461de3f759db2520b9c6 (patch)
tree29e64ed5fc06586b0a52ee414098d335d6f836ae /lib
parent46549d6b11eb88d02bd2ac4561ab3c7b775cd241 (diff)
[DOC] Refactors documentation for `Forwardable`
[ruby-core:71281] [Misc #11639] From: Sam Morgan <s_morgan@me.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/forwardable.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/forwardable.rb b/lib/forwardable.rb
index bcd462a97c..f5202f9318 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -57,10 +57,9 @@
#
# == 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