mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
This commit is contained in:
parent
46549d6b11
commit
141ed2f640
1 changed files with 3 additions and 4 deletions
|
@ -57,10 +57,9 @@
|
||||||
#
|
#
|
||||||
# == Another example
|
# == Another example
|
||||||
#
|
#
|
||||||
# We want to rely on what has come before obviously, but with delegation we can
|
# You could use Forwardable as an alternative to inheritance, when you don't want
|
||||||
# take just the methods we need and even rename them as appropriate. In many
|
# to inherit all methods from the superclass. For instance, here is how you might
|
||||||
# cases this is preferable to inheritance, which gives us the entire old
|
# add a range of +Array+ instance methods to a new class +Queue+:
|
||||||
# interface, even if much of it isn't needed.
|
|
||||||
#
|
#
|
||||||
# class Queue
|
# class Queue
|
||||||
# extend Forwardable
|
# extend Forwardable
|
||||||
|
|
Loading…
Add table
Reference in a new issue