From cfbae7dae052180e5dde05a27948ae8d779eccab Mon Sep 17 00:00:00 2001 From: Espartaco Palma Date: Sun, 7 Jun 2020 01:01:37 -0700 Subject: [PATCH] [skip-ci] Clarification for dup vs clone docs Both clone & dup returns a new object when executed on the documentation looks like they are returning the same object cloned or dup'ed which is true for method as extend, but not for the above mentioned. --- object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/object.c b/object.c index b47635f1fd..9fb14817cd 100644 --- a/object.c +++ b/object.c @@ -550,11 +550,11 @@ rb_obj_clone(VALUE obj) * s1.extend(Foo) #=> # * s1.foo #=> "foo" * - * s2 = s1.clone #=> # + * s2 = s1.clone #=> # * s2.foo #=> "foo" * - * s3 = s1.dup #=> # - * s3.foo #=> NoMethodError: undefined method `foo' for # + * s3 = s1.dup #=> # + * s3.foo #=> NoMethodError: undefined method `foo' for # *-- * Equivalent to \c Object\#dup in Ruby *++