class FirefoxJson::Profiles
Access to the profiles.ini file that links to all defined profiles and their locations
Public Class Methods
new(path = File.join(Dir.home, '.mozilla/firefox'))
click to toggle source
# File lib/firefox-json/profiles.rb, line 27 def initialize(path = File.join(Dir.home, '.mozilla/firefox')) @ff_path = path data = IniFile.load(File.join(@ff_path, 'profiles.ini')) p_sections = data.sections.select {|section| section.start_with?('Profile')} @profile_map = p_sections.reduce({}) do |hash, section| profile = data[section] hash[profile['Name'].freeze] = profile.freeze hash end end
Public Instance Methods
[](name)
click to toggle source
# File lib/firefox-json/profiles.rb, line 42 def [](name) if @profile_map.key?(name) Profile.new(@profile_map[name], @ff_path) end end
list()
click to toggle source
# File lib/firefox-json/profiles.rb, line 38 def list @profile_map.keys.dup end