Skip to content

Instantly share code, notes, and snippets.

@dezmathio

dezmathio/2.rb Secret

Created April 29, 2014 21:32
Show Gist options
  • Save dezmathio/c35e128c76fce8d99b7c to your computer and use it in GitHub Desktop.
Save dezmathio/c35e128c76fce8d99b7c to your computer and use it in GitHub Desktop.
pages.sort { |a,b| a.display != b.display ? (a.display && !b.display ? -1 : 1) : a.display ? a.position <=> b.position : a.title <=> b.title }
####
pages.sort {
|a,b|
if a.display != b.display
if a.display && !b.display
-1
else
1
end
else
if a.display?
a.position <=> b.position
if
a.title <=> b.title
end
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment