Method: MacWifi::MacOsModel#ip_address

Defined in:
lib/mac-wifi/mac_os_model.rb

#ip_addressObject

Returns the IP address assigned to the wifi port, or nil if none.



215
216
217
218
219
220
221
222
223
224
225
# File 'lib/mac-wifi/mac_os_model.rb', line 215

def ip_address
  begin
    run_os_command("ipconfig getifaddr #{wifi_hardware_port}").chomp
  rescue OsCommandError => error
    if error.exitstatus == 1
      nil
    else
      raise
    end
  end
end