fix for safe_sort for ruby 1.9.2 because Kernel now defines <=> for Object #83

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+1 −4
Diff settings

Always

Just for now

@@ -34,7 +34,7 @@ def description
private
def safe_sort(array)
- array.all?{|item| item.respond_to?(:<=>)} ? array.sort : array
+ array.sort rescue array
end
def difference_between_arrays(array_1, array_2)
@@ -1,9 +1,6 @@
require 'spec_helper'
class UnsortableObject
- # ruby-1.9.2 adds <=> to Object
- undef_method :<=> rescue nil
-
def initialize(id)
@id = id
end