Module: Ronin::Web::CLI::BrowserOptions Private
- Included in:
- Commands::Browser, Commands::Screenshot
- Defined in:
- lib/ronin/web/cli/browser_options.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds options for opening a browser.
Class Method Summary collapse
-
.included(command) ⇒ Object
private
Adds the browser options to the command including BrowserOptions.
Instance Method Summary collapse
-
#browser ⇒ Ronin::Web::Browser::Agent
private
The browser agent.
-
#browser_kwargs ⇒ Hash{Symbol => Object}
private
Keyword arguments for
Ronin::Web::Browser.new
.
Class Method Details
.included(command) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds the browser options to the command including Ronin::Web::CLI::BrowserOptions.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ronin/web/cli/browser_options.rb', line 38 def self.included(command) command.option :browser, short: '-B', value: { type: String, usage: 'NAME|PATH' }, desc: 'The browser name or path to execute' command.option :width, short: '-W', value: { type: Integer, default: 1024, usage: 'WIDTH' }, desc: 'Sets the width of the browser viewport' command.option :height, short: '-H', value: { type: Integer, default: 768, usage: 'HEIGHT' }, desc: 'Sets the height of the browser viewport' end |
Instance Method Details
#browser ⇒ Ronin::Web::Browser::Agent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The browser agent.
68 69 70 |
# File 'lib/ronin/web/cli/browser_options.rb', line 68 def browser @browser ||= Web::Browser.new(**browser_kwargs) end |
#browser_kwargs ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Keyword arguments for Ronin::Web::Browser.new
.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ronin/web/cli/browser_options.rb', line 78 def browser_kwargs kwargs = { window_size: [[:width], [:height]] } if [:browser] kwargs[:browser_path] = [:browser] end return kwargs end |