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:
parent
6fdd5e26c6
commit
2d89af45ea
Notes:
git
2020-06-26 00:21:52 +09:00
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user