Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/simms_structures/hashing.rb
Instance Method Summary collapse
Instance Method Details
#hash ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/simms_structures/hashing.rb', line 24 def hash hashed_array = [] each do |key, val| hashed_array << key.hash * val.hash end # we need to sort the hashed_array to ensure that the same hash is # generated from two hashes with different order of elements hashed_array.sort.hash end |