Class: AirportEvents::Airport
- Inherits:
-
Object
- Object
- AirportEvents::Airport
- Defined in:
- lib/airport_events/airport.rb
Constant Summary collapse
- INFO_COMMAND =
"airport -I 2>&1"
Class Method Summary collapse
- .connected? ⇒ Boolean
- .ensure_airport_command! ⇒ Object
- .parse_ssid(result) ⇒ Object
- .run_info_command ⇒ Object
- .ssid ⇒ Object
Class Method Details
.connected? ⇒ Boolean
16 17 18 |
# File 'lib/airport_events/airport.rb', line 16 def self.connected? ssid.length > 0 end |
.ensure_airport_command! ⇒ Object
5 6 7 8 9 10 |
# File 'lib/airport_events/airport.rb', line 5 def self.ensure_airport_command! run_info_command unless $?.exitstatus == 0 raise "Fatal: the 'airport' command is not in PATH. Run 'airport-log enable_airport' for instructions." end end |
.parse_ssid(result) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/airport_events/airport.rb', line 24 def self.parse_ssid result if result.match /\sSSID: / result[/\sSSID: (.*?)\n/, 1] else "" end end |
.run_info_command ⇒ Object
20 21 22 |
# File 'lib/airport_events/airport.rb', line 20 def self.run_info_command %x(#{INFO_COMMAND}) end |
.ssid ⇒ Object
12 13 14 |
# File 'lib/airport_events/airport.rb', line 12 def self.ssid parse_ssid(run_info_command) end |