Skip to content

Instantly share code, notes, and snippets.

@vidmantas
Created October 2, 2013 09:23
Show Gist options
  • Save vidmantas/6791181 to your computer and use it in GitHub Desktop.
Save vidmantas/6791181 to your computer and use it in GitHub Desktop.
arr = [1,2,3]
sorted = arr.sort do |a, b|
if b == 2
1
else
a <=> b
end
end
puts sorted.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment