lib/hooray/settings.rb in hooray-0.0.5 vs lib/hooray/settings.rb in hooray-0.0.7
- old
+ new
@@ -15,10 +15,14 @@
def load!
no_config_folder unless Dir.exist?(CONFIG_DIR)
@all = YAML.load_file(CONFIG_DIR + 'settings.yml')
@services = YAML.load_file(CONFIG_DIR + 'services.yml')
@devices = YAML.load_file(CONFIG_DIR + 'devices.yml')
+ read_mac_prefixes
+ end
+
+ def read_mac_prefixes
@macs = {}
File.read(CONFIG_DIR + 'nmap-mac-prefixes').each_line do |line|
next if line =~ /^\s*#/
prefix, *name = *line.split(/\s/)
@macs.store(prefix, name.join(' '))
@@ -37,10 +41,10 @@
devices ||= {}
devices[mac.to_sym] || devices[mac.to_s]
end
def family(mac)
- prefix = mac.to_s.gsub(':', '')[0,6].upcase
+ prefix = mac.to_s.gsub(':', '')[0, 6].upcase
macs[prefix]
end
def all
@all ||= {}