Project

General

Profile

Bug #11929

No programatic way to check ability to dup/clone an object

Added by lkdjiin (xavier nayrac) over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-12-06 trunk 52904) [i686-linux]
[ruby-core:72621]

Description

We can't dup a Fixnum, and it's ok. But I'm wondering «why is Fixnum saying it can dup?»

1.respond_to?(:dup) #=> true

Don't you think that the dup method should be undefined in the class Fixnum?

Currently I can do class Fixnum; undef :dup; end, but that should be in the core Ruby, isn't it?


Related issues

Related to Ruby master - Feature #12979: Avoid exception for #dup on Integer (and similar cases)Closednobu (Nobuyoshi Nakada)Actions

Also available in: Atom PDF