From 2d89af45ea8b3f521102c05694f419ecd8254e69 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Thu, 25 Jun 2020 09:34:11 -0500 Subject: [PATCH] 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. --- lib/delegate.rb | 4 ++++ 1 file changed, 4 insertions(+) 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