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

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: 1.2.4
    • Component/s: None
    • Labels:
    • Environment:
      Ubuntu 10.04

      >> 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.

            Assignee:
            kbanker Kyle Banker
            Reporter:
            ryan.cooke Ryan Cooke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: