aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-07-16 03:42:16 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-07-16 03:48:11 +0900
commit998fa9b158d7b021dd6a7a96bca45b6abc115ba4 (patch)
treefda670dc40c06656c42fef1ac5baadc1babd5805 /guides
parent83c6ea3a250361b3fc91df0a8277ee1576624ffe (diff)
downloadrails-998fa9b158d7b021dd6a7a96bca45b6abc115ba4.tar.gz
rails-998fa9b158d7b021dd6a7a96bca45b6abc115ba4.tar.bz2
rails-998fa9b158d7b021dd6a7a96bca45b6abc115ba4.zip
Remove caveat for older Ruby's `dup` behavior [ci skip]
In older Ruby, nil, Symbol, Fixnum, Rational, and Complex were not duplicable. In Ruby 2.5, all of them are duplicable.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_support_core_extensions.md9
1 files changed, 0 insertions, 9 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 61f1715dab..f36cacfe8d 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -155,15 +155,6 @@ Complex(1).duplicable? # => true
1.method(:+).duplicable? # => false
```
-`duplicable?` matches the current Ruby version's `dup` behavior,
-so results will vary according the version of Ruby you're using.
-In Ruby 2.4, for example, Complex and Rational are not duplicable:
-
-```ruby
-Rational(1).duplicable? # => false
-Complex(1).duplicable? # => false
-```
-
WARNING: Any class can disallow duplication by removing `dup` and `clone` or raising exceptions from them. Thus only `rescue` can tell whether a given arbitrary object is duplicable. `duplicable?` depends on the hard-coded list above, but it is much faster than `rescue`. Use it only if you know the hard-coded list is enough in your use case.
NOTE: Defined in `active_support/core_ext/object/duplicable.rb`.