diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-12-22 20:27:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-22 20:27:08 +0100 |
commit | fd63aa02289d64e9d14fe56723f1de64bca3bb1f (patch) | |
tree | 02053aff8957ddd0bf209b30927b9749c818659a /activesupport/lib/active_support | |
parent | 2fd3034bf1862bb8e40c0a0a162316b8ff564d0e (diff) | |
parent | 83d3b0dbf17582401eb549c4a30f03ecbbfd1a88 (diff) | |
download | rails-fd63aa02289d64e9d14fe56723f1de64bca3bb1f.tar.gz rails-fd63aa02289d64e9d14fe56723f1de64bca3bb1f.tar.bz2 rails-fd63aa02289d64e9d14fe56723f1de64bca3bb1f.zip |
Merge pull request #27424 from utilum/fix_complex_and_rational_are_duplicable
Fix duplicable? for Complex and Rational
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/duplicable.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb index ebe31b38ca..c671d34673 100644 --- a/activesupport/lib/active_support/core_ext/object/duplicable.rb +++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb @@ -121,3 +121,23 @@ class Method false end end + +class Complex + # Complexes are not duplicable: + # + # Complex(1).duplicable? # => false + # Complex(1).dup # => TypeError: can't copy Complex + def duplicable? + false + end +end + +class Rational + # Rationals are not duplicable: + # + # Rational(1).duplicable? # => false + # Rational(1).dup # => TypeError: can't copy Rational + def duplicable? + false + end +end |