Skip to content

Commit

Permalink
Call #to_s on each array element.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndbroadbent committed Nov 9, 2012
1 parent 75772db commit 627f8fe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dictionary_order_sort/array.rb
Expand Up @@ -5,8 +5,9 @@ class Array
def dict_sort
sorting_cache = {}
sort do |a, b|
c, d = [a, b].map do |f|
sorting_cache[f] ||= f.gsub /\W|[_\s]/, ''
c, d = [a, b].map do |el|
str = el.to_s
sorting_cache[str] ||= str.gsub /\W|[_\s]/, ''
end
c <=> d
end
Expand Down

0 comments on commit 627f8fe

Please sign in to comment.