Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/odds/ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#each_sorted_by_value_desc(&b) ⇒ Object



2
3
4
# File 'lib/odds/ext/hash.rb', line 2

def each_sorted_by_value_desc(&b)
  to_a.sort_by { |pair| pair[1] }.reverse.each { |pair| b[*pair] }
end