summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-07 13:03:35 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-07 13:03:35 (GMT)
commit23228b6e3139fb33d42f6dae4ec9bdabb21e52b2 (patch)
treea3e7ae2b1c4ce4f0d084cb9136fdf730c66a02c2 /numeric.c
parentba267bce47e4f295bfe6907bfcde8a6b82a5fbf9 (diff)
Remove outdated example from Numeric documentation
Since 2.5, Numeric instances can be cloned and duplicated. [Fix GH-1850] From: Miguel Landaeta <miguel@miguel.cc> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/numeric.c b/numeric.c
index 01856c7..1af74a9 100644
--- a/numeric.c
+++ b/numeric.c
@@ -5277,10 +5277,11 @@ rb_int_s_isqrt(VALUE self, VALUE num)
* 1.object_id == a.object_id #=> true
*
* There can only ever be one instance of the integer +1+, for example. Ruby ensures this
- * by preventing instantiation and duplication.
+ * by preventing instantiation. If duplication is attempted, the same instance is returned.
*
- * Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
- * 1.dup #=> TypeError: can't dup Integer
+ * Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
+ * 1.dup #=> 1
+ * 1.object_id == 1.dup.object_id #=> true
*
* For this reason, Numeric should be used when defining other numeric classes.
*