Skip to content

Instantly share code, notes, and snippets.

@workmad3
Last active April 18, 2016 16:41
ary.sort do |left, right|
IMPORTANT = %w(X Y)
if IMPORTANT.include?(left) && IMPORTANT.include?(right)
IMPORTANT.index(left) <=> IMPORTANT.index(right)
elsif IMPORTANT.include?(left)
1
elsif IMPORTANT.include?(right)
-1
else
left <=> right
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment