Hash Subclass#== not respected when checking equality of collections. ---------------------------------------------------------------------
Key: JRUBY-5883 URL: https://jira.codehaus.org/browse/JRUBY-5883 Project: JRuby Issue Type: Bug Components: Core Classes/Modules, Ruby 1.8.7, Ruby 1.9.2 Affects Versions: JRuby 1.6.2 Environment: OSX Snow Leopard 10.6.7, Java 1.6.0_24, JRuby 1.6.2 installed through RVM 1.6.20 Reporter: Zach Moazeni When subclassing a Hash and overriding "==()" instance1 == instance2 works, but [instance1] == [instance2] doesn't. This behavior is inconsistent with mri 1.8.7, 1.9.2, and rubinius. {code} class HashSubclass < Hash def ==(other) self["some_key"] == other["some_key"] end end h1 = HashSubclass.new h2 = HashSubclass.new h1["some_key"] = 1 h2["some_key"] = 1 h2["some_other_key"] = 1 h1 == h2 # true on JRuby, 1.8.7, 1.9.2, Rubinius [h1] == [h2] # false on JRuby. True on 1.8.7, 1.9.2, Rubinius {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email