summaryrefslogtreecommitdiff
path: root/lib/delegate.rb
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+foo@gmail.com>2020-06-25 09:34:11 -0500
committerYuki Nishijima <yk.nishijima@gmail.com>2020-06-25 11:21:13 -0400
commit2d89af45ea8b3f521102c05694f419ecd8254e69 (patch)
tree2074294d361557c70f9375bb3b1e40767e938750 /lib/delegate.rb
parent6fdd5e26c648367b50e8d36cbb3ee257065f58c6 (diff)
Add require to Delegator examples
In Ruby 2.7.1 SimpeDelegator cannot be used without requiring `delegate` this PR adds the require to the first example for each class so that devs don't have to hunt for what require to use.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3254
Diffstat (limited to 'lib/delegate.rb')
-rw-r--r--lib/delegate.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index c540c2ec77..d6fb90bdbf 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -21,6 +21,8 @@
# SimpleDelegator's implementation serves as a nice example of the use of
# Delegator:
#
+# require 'delegate'
+#
# class SimpleDelegator < Delegator
# def __getobj__
# @delegate_sd_obj # return object we are delegating to, required
@@ -253,6 +255,8 @@ end
# end
# end
#
+# require 'delegate'
+#
# class UserDecorator < SimpleDelegator
# def birth_year
# born_on.year