Class: Wifimap::Mac

Inherits:
Object
  • Object
show all
Defined in:
lib/wifimap/mac.rb

Class Method Summary collapse

Class Method Details

.manufacturer(mac) ⇒ String

Get the manufacturer for the given mac address.

Parameters:

  • mac (String)

Returns:

  • (String)


19
20
21
# File 'lib/wifimap/mac.rb', line 19

def self.manufacturer(mac)
  Louis.lookup(mac)['long_vendor']
end

.valid?(mac) ⇒ Boolean

Return true if the mac format is correct, false otherwise.

Parameters:

  • mac (String)

Returns:

  • (Boolean)


11
12
13
# File 'lib/wifimap/mac.rb', line 11

def self.valid?(mac)
  mac =~ /([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})/ ? true : false
end