module DeepSort
Deep Sort Utility Over View
when included into a project, this utility gives Arrays and Hashes the ability to deep sort themselves instead of shallow sorts, deep_sort recursively attempts to sort every element of arrays and hashes
Usage
{2=>4, 1=>[3, 2]}.deep_sort
returns: {1=>[2, 3], 2=>4}
[{2=>3}, 1].deep_sort
returns an error because a Fixnum (1) cannot be compared with a Hash ({2=>3})
[{2=>3}, 1].deep_sort_by {|obj| obj.to_s}
returns: [1, {2=>3}] # this avoids the error by using string comparison
foo = [2, 1]; foo.deep_sort!
returns: [1, 2] # in addition foo has now been sorted in place