Skip to content

Commit

Permalink
Self review
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsSteensma committed Mar 27, 2024
1 parent 8c3d143 commit 543275b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Dhalang/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class Configuration
private attr_accessor :screenshot_options
private attr_accessor :jpeg_options

# @param [Hash] custom_options Changes that should override default.
# @param [Hash] custom_options Changes that override default.
# @param [String] page_url Url for Puppeteer to visit.
# @param [String] temp_file_path Absolute path of temp file to write results of scripts towards.
# @param [String] temp_file_path Absolute path of temp file to use for writing script results.
# Can be nil for scripts using stdout.
# @param [String] temp_file_extension Extension of temp file. Can be nil for scripts using stdout.
def initialize(custom_options, page_url, temp_file_path = nil, temp_file_extension = nil)
Expand Down
8 changes: 4 additions & 4 deletions lib/Dhalang/node_script_invoker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class NodeScriptInvoker

# Executes JS script under given script_path by launching a new Node process.
#
# @param [String] script_path Absolute path of the JS script to execute.
# @param [Configuration] configuration Configuration to use by j.
# @param [String] script_path Absolute path of JS script to execute.
# @param [Configuration] configuration Configuration to use.
def self.execute_script(script_path, configuration)
command = create_node_command(script_path, configuration)
Open3.popen2e(command) do |_stdin, stdouterr, wait|
Expand All @@ -17,10 +17,10 @@ def self.execute_script(script_path, configuration)
end
end

# Returns a [String] with the node command to invoke the provided script with the configuration.
# Returns a [String] with node command that invokes the provided script with the configuration.
#
# @param [String] script_path Absolute path of JS script to invoke.
# @param [Object] configuration JSON with options to use for Puppeteer.
# @param [Configuration] configuration Configuration to use.
private_class_method def self.create_node_command(script_path, configuration)
"node #{script_path} #{Shellwords.escape(configuration.json)}"
end
Expand Down
1 change: 1 addition & 0 deletions lib/js/screenshot-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const createScreenshot = async () => {
...configuration.screenshotOptions
});
} catch (error) {
console.error(error.message);
process.exit(1);
} finally {
if (browser) {
Expand Down

0 comments on commit 543275b

Please sign in to comment.