Method: Collins::Asset#gateway_address

Defined in:
lib/collins/asset.rb

#gateway_address(pool = "default") ⇒ String

Note:

If there is no address in the specified pool, the gateway of the first usable address is

Return the gateway address for the specified pool, or the first gateway used, which may not be desired.

Parameters:

  • pool (String) (defaults to: "default")

    The address pool to find a gateway on

Returns:

  • (String)

    Gateway address, or nil



172
173
174
175
176
177
178
179
180
# File 'lib/collins/asset.rb', line 172

def gateway_address pool = "default"
  address = addresses.select{|a| a.pool == pool}.map{|a| a.gateway}.first
  return address if address
  if addresses.length > 0 then
    addresses.first.gateway
  else
    nil
  end
end