Skip to content

Instantly share code, notes, and snippets.

@jrich523
Created June 18, 2018 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrich523/1eb7bc425367ded87278542ba76e7156 to your computer and use it in GitHub Desktop.
Save jrich523/1eb7bc425367ded87278542ba76e7156 to your computer and use it in GitHub Desktop.
def _sort(items, guest)
items.sort do |item1, item2|
if item1.guest_count(guest.application, guest.environment) == item2.guest_count(guest.application, guest.environment)
item1.usedmem <=> item2.usedmem
else
item1.guest_count(guest.application, guest.environment) <=> item2.guest_count(guest.application, guest.environment)
end
end
end
##### vs
def _sort(items, guest)
items.sort do |item1, item2|
item1.guest_count(guest.application, guest.environment), item1.usedmem <=> item2.guest_count(guest.application, guest.environment),item2.usedmem
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment