Class: Selenium::WebDriver::Firefox::ProfilesIni Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rb/lib/selenium/webdriver/firefox/profiles_ini.rb |
Class Method Summary
- .new ⇒ ProfilesIni constructor Internal use only
Instance Method Summary
- #[](name) Internal use only
- #refresh Internal use only
- #parse private Internal use only
- #path_for(name, is_relative, path) private Internal use only
Constructor Details
.new ⇒ ProfilesIni
# File 'rb/lib/selenium/webdriver/firefox/profiles_ini.rb', line 25
def initialize @ini_path = File.join(Util.app_data_path, 'profiles.ini') @profile_paths = {} parse if File.exist?(@ini_path) end
Instance Method Details
#[](name)
[ GitHub ]#parse (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/firefox/profiles_ini.rb', line 44
def parse string = File.read @ini_path name = nil is_relative = nil path = nil string.split("\n").each do |line| case line when /^\[Profile/ name, path = nil if path_for(name, is_relative, path) when /^Name=(.+)$/ name = Regexp.last_match(1)&.strip when /^IsRelative=(.+)$/ is_relative = Regexp.last_match(1).strip == '1' when /^Path=(.+)$/ path = Regexp.last_match(1).strip p = path_for(name, is_relative, path) @profile_paths[name] = p if p end end end
#path_for(name, is_relative, path) (private)
[ GitHub ]#refresh
[ GitHub ]# File 'rb/lib/selenium/webdriver/firefox/profiles_ini.rb', line 37
def refresh @profile_paths.clear parse end