lib/hooray/settings.rb in hooray-0.0.7 vs lib/hooray/settings.rb in hooray-0.0.9
- old
+ new
@@ -2,14 +2,14 @@
# App settings
class Settings
CONFIG_DIR = ENV['HOME'] + '/.hooray/'
class << self
- attr_accessor :all, :services, :devices, :macs
+ attr_accessor :all
def no_config_folder
- puts "No config folder, run `#{$PROGRAM_NAME} init`"
+ pa "No config folder, run `#{$PROGRAM_NAME} init`", :red
puts
exit 1
end
def load!
@@ -35,18 +35,30 @@
out += ' SERVICE' if service_scan
out += ' OS' if os_fingerprint
out
end
+ def devices
+ @devices ||= {}
+ end
+
def device(mac)
- devices ||= {}
devices[mac.to_sym] || devices[mac.to_s]
end
- def family(mac)
+ def services
+ @services ||= {}
+ end
+
+ def manufacturers
+ @macs || {}
+ end
+
+ def manufacturer(mac)
prefix = mac.to_s.gsub(':', '')[0, 6].upcase
- macs[prefix]
+ manufacturers[prefix]
end
+ alias_method :family, :manufacturer
def all
@all ||= {}
end