From: giginet.net@... Date: 2017-03-29T09:04:47+00:00 Subject: [ruby-core:80459] [Ruby trunk Bug#12684] Delegator#eql? missing Issue #12684 has been updated by giginet (Kohki Miki). I fixed this issue and I added the specs. Could you check it? https://github.com/ruby/ruby/pull/1564 https://github.com/ruby/spec/pull/399 ---------------------------------------- Bug #12684: Delegator#eql? missing https://bugs.ruby-lang.org/issues/12684#change-63953 * Author: carsonreinke (Carson Reinke) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.3.1 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- There is some strange behavior because Delegator is missing an alias of #eql? to #== `2.3.1 :001 > s = 'test' => "test" 2.3.1 :002 > d = SimpleDelegator.new(s) => "test" 2.3.1 :003 > d.eql?(d) => false 2.3.1 :004 > d == d => true 2.3.1 :005 > d.hash == d.hash => true` I understand that `Delegator` is a `BasicObject` and that does not define #eql? method, but this method is being used by Array. For example, `2.3.1 :001 > s = 'test' => "test" 2.3.1 :002 > a = [SimpleDelegator.new(s), SimpleDelegator.new(s)] => ["test", "test"] 2.3.1 :003 > a[0] == a[1] => true 2.3.1 :004 > a.uniq() => ["test", "test"] 2.3.1 :005 > a[0].hash == a[1].hash => true` Kind of strange behavior, especially reading the documentation. Now maybe, `Array#uniq` should be changed to use #== instead of #eql? -- https://bugs.ruby-lang.org/ Unsubscribe: