1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Richard Schneeman 2020-06-25 09:34:11 -05:00 committed by Yuki Nishijima
parent 6fdd5e26c6
commit 2d89af45ea
Notes: git 2020-06-26 00:21:52 +09:00

View file

@ -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