From 998fa9b158d7b021dd6a7a96bca45b6abc115ba4 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 16 Jul 2019 03:42:16 +0900 Subject: 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. --- guides/source/active_support_core_extensions.md | 9 --------- 1 file changed, 9 deletions(-) (limited to 'guides') 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`. -- cgit v1.2.3