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:
parent
c151dd081b
commit
640dbd4c71
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue