ruby-changes:61935
From: Richard <ko1@a...>
Date: Fri, 26 Jun 2020 00:21:38 +0900 (JST)
Subject: [ruby-changes:61935] 2d89af45ea (master): Add require to Delegator examples
https://git.ruby-lang.org/ruby.git/commit/?id=2d89af45ea From 2d89af45ea8b3f521102c05694f419ecd8254e69 Mon Sep 17 00:00:00 2001 From: Richard Schneeman <richard.schneeman+foo@g...> Date: Thu, 25 Jun 2020 09:34:11 -0500 Subject: 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. diff --git a/lib/delegate.rb b/lib/delegate.rb index c540c2e..d6fb90b 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -21,6 +21,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/delegate.rb#L21 # 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 https://github.com/ruby/ruby/blob/trunk/lib/delegate.rb#L255 # end # end # +# require 'delegate' +# # class UserDecorator < SimpleDelegator # def birth_year # born_on.year -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/