Class: StrictComparableHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/tasks/capistrano_tasks.rb

Overview

basically { :a => 1, :b => 2 }.eql?({ :b => 2, :a => 1}) => true

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/tasks/capistrano_tasks.rb', line 9

def eql?(other)
  self == other
end

#hashObject

must return an integer or #eql? will be ignored by Comparable assumes hash elements are strings will break if a value is something else whose to_s varies randomly



16
17
18
# File 'lib/tasks/capistrano_tasks.rb', line 16

def hash
  Zlib.crc32(to_a.map(&:to_s).sort.to_s)
end