Skip to content

Instantly share code, notes, and snippets.

@julioterra
Created October 5, 2011 18:09
Show Gist options
  • Select an option

  • Save julioterra/1265192 to your computer and use it in GitHub Desktop.

Select an option

Save julioterra/1265192 to your computer and use it in GitHub Desktop.
enumerable sorting
[obj_0, obj_ 1, obj_ 2, obj_ 3, obj_ 4, obj_ 5].sort do |obj_a, obj_ b|
obj_a.year <=> obj_b.year
end
# for illustration only - not functional code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment