Class: SeleniumConnect::Configuration
- Inherits:
-
Object
- Object
- SeleniumConnect::Configuration
- Defined in:
- lib/selenium_connect/configuration.rb
Overview
Encapsulates the configuration
Instance Attribute Summary collapse
-
#background ⇒ Object
Selenium Server.
-
#browser ⇒ Object
Browsers.
-
#browser_path ⇒ Object
Browsers.
-
#browser_version ⇒ Object
SauceLabs.
-
#description ⇒ Object
SauceLabs.
-
#host ⇒ Object
Selenium Server.
-
#jar ⇒ Object
Selenium Server.
-
#log ⇒ Object
Selenium Server.
-
#os ⇒ Object
SauceLabs.
-
#port ⇒ Object
Selenium Server.
-
#profile_name ⇒ Object
Browsers.
-
#profile_path ⇒ Object
Browsers.
-
#sauce_api_key ⇒ Object
SauceLabs.
-
#sauce_username ⇒ Object
SauceLabs.
-
#version ⇒ Object
Selenium Server.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #populate_with_hash(hash) ⇒ Object
- #populate_with_yaml(file) ⇒ Object (also: #config_file=)
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 |
# File 'lib/selenium_connect/configuration.rb', line 22 def initialize(opts = {}) @host = 'localhost' @port = 4444 @browser = 'firefox' populate_with_hash opts unless opts.empty? end |
Instance Attribute Details
#background ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def background @background end |
#browser ⇒ Object
Browsers
15 16 17 |
# File 'lib/selenium_connect/configuration.rb', line 15 def browser @browser end |
#browser_path ⇒ Object
Browsers
15 16 17 |
# File 'lib/selenium_connect/configuration.rb', line 15 def browser_path @browser_path end |
#browser_version ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def browser_version @browser_version end |
#description ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def description @description end |
#host ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def host @host end |
#jar ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def jar @jar end |
#log ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def log @log end |
#os ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def os @os end |
#port ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def port @port end |
#profile_name ⇒ Object
Browsers
15 16 17 |
# File 'lib/selenium_connect/configuration.rb', line 15 def profile_name @profile_name end |
#profile_path ⇒ Object
Browsers
15 16 17 |
# File 'lib/selenium_connect/configuration.rb', line 15 def profile_path @profile_path end |
#sauce_api_key ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def sauce_api_key @sauce_api_key end |
#sauce_username ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def sauce_username @sauce_username end |
#version ⇒ Object
Selenium Server
11 12 13 |
# File 'lib/selenium_connect/configuration.rb', line 11 def version @version end |
Instance Method Details
#populate_with_hash(hash) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/selenium_connect/configuration.rb', line 29 def populate_with_hash(hash) hash.each do |key, value| begin self.send "#{key}=", value unless value.nil? rescue NoMethodError raise ArgumentError.new "The config key: \"#{key}\" is unknown!" end end end |
#populate_with_yaml(file) ⇒ Object Also known as: config_file=
39 40 41 |
# File 'lib/selenium_connect/configuration.rb', line 39 def populate_with_yaml(file) populate_with_hash YAML.load_file file end |