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

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@pvh
Contributor
pvh commented Jul 13, 2011

I made a corresponding issue with more details about the bug.

Contributor
pvh commented Jul 13, 2011

details:
ruby core issue 24063 added Kernel::<=> to Object (note that Kernel module documentation does not display this functionality).

as a result, safe_sort isn't anymore, and trying to =~ any objects that don't define a better <=> throws an exception.

i'll attach a somewhat plausible patch momentarily

Owner

Can you add a spec for this that fails in 1.9.2 without this change?

Owner

Actually, looks like #81 provides them :)

Contributor
pvh commented Jul 13, 2011

Brilliant. I'll check and see if anywhere else is checking for <=> while I'm at it.

@dchelimsky dchelimsky added a commit that closed this pull request Jul 30, 2011
@dchelimsky Peter van Hardenberg + dchelimsky if the sort fails, rescue and return the array as-is
- Closes #81.
- Closes #83.
d49eba7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment