Module: MoreCoreExtensions::HashSortByBang

Defined in:
lib/more_core_extensions/core_ext/hash/sorting.rb

Instance Method Summary collapse

Instance Method Details

#sort_by!(*args, &block) ⇒ Object



11
12
13
14
15
# File 'lib/more_core_extensions/core_ext/hash/sorting.rb', line 11

def sort_by!(*args, &block)
  sorted = sort_by(*args, &block)
  sorted = self.class[sorted.to_a] unless sorted.instance_of?(self.class)
  replace(sorted)
end