Method: WifiWand::MacOsModel#connected_network_name

Defined in:
lib/wifi-wand/models/mac_os_model.rb

#connected_network_nameObject

Returns the network currently connected to, or nil if none.



186
187
188
189
190
191
192
193
# File 'lib/wifi-wand/models/mac_os_model.rb', line 186

def connected_network_name
  return nil unless wifi_on? # no need to try

  command_output = run_os_command("ipconfig getsummary #{wifi_interface} | grep ' SSID :'", false)
  return nil if command_output.empty?

  command_output.split('SSID :').last.strip
end