Class: Webdriver::UserAgent::BrowserOptions
- Inherits:
-
Object
- Object
- Webdriver::UserAgent::BrowserOptions
- Defined in:
- lib/webdriver-user-agent/browser_options.rb
Instance Method Summary collapse
- #browser_options ⇒ Object
-
#initialize(opts, user_agent_string) ⇒ BrowserOptions
constructor
A new instance of BrowserOptions.
- #method_missing(*args, &block) ⇒ Object
Constructor Details
#initialize(opts, user_agent_string) ⇒ BrowserOptions
Returns a new instance of BrowserOptions.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/webdriver-user-agent/browser_options.rb', line 13 def initialize(opts, user_agent_string) @options = opts [:browser] ||= :firefox [:agent] ||= :iphone [:orientation] ||= :portrait set_preview_option([:safari_technology_preview]) if (@options[:browser] == :safari) [:viewport_width], [:viewport_height] = ([:viewport_width], [:viewport_height]) initialize_for_browser(user_agent_string, opts[:accept_language_string], opts[:options]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/webdriver-user-agent/browser_options.rb', line 25 def method_missing(*args, &block) m = args.first value = [m] super unless value value.downcase end |
Instance Method Details
#browser_options ⇒ Object
32 33 34 |
# File 'lib/webdriver-user-agent/browser_options.rb', line 32 def .except(:browser, :agent, :orientation, :user_agent_string, :accept_language_string, :viewport_width, :viewport_height, :safari_technology_preview) end |