1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

sort array to avoid extraneous arrays

This commit is contained in:
Erik Mackdanz 2014-02-24 10:44:43 -06:00
parent c151dd081b
commit 640dbd4c71

View file

@ -123,7 +123,18 @@ module Fog
# Return them all, leading with manually assigned addresses
manual = all_addresses.map{|addr| addr["ip"]}
manual + ( all_floating - manual )
all_floating.sort{ |a,b|
a_manual = manual.include? a
b_manual = manual.include? b
if a_manual and !b_manual
-1
elsif !a_manual and b_manual
1
else 0 end
}
end
alias_method :public_ip_addresses, :floating_ip_addresses