Created
June 18, 2018 15:40
-
-
Save jrich523/1eb7bc425367ded87278542ba76e7156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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