Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-292

BSON OrderedHash .hash function gives a different result than ruby's Hash .hash function

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.2.4
    • Fix Version/s: 1.4.0
    • Component/s: None
    • Labels:
    • Environment:
      Ubuntu 10.04

      Description

      >> h = Hash[

      {"a" => 1}]
      => {"a"=>1}
      >> oh = BSON::OrderedHash[{"a" => 1}

      ]
      =>

      {"a"=>1}

      >> h.eql? oh
      => true
      >> h.hash.eql? oh.hash
      => false
      >> h.hash.eql? Hash[oh].hash
      => true

      Is this behavior intentional? It complicates code where hashes are being used as hash keys.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: