lib/selenium/webdriver/support/cdp_client_generator.rb in selenium-webdriver-4.1.0 vs lib/selenium/webdriver/support/cdp_client_generator.rb in selenium-webdriver-4.2.0
- old
+ new
@@ -42,12 +42,12 @@
browser_protocol = JSON.parse(File.read(browser_protocol_path), symbolize_names: true)
js_protocol = JSON.parse(File.read(js_protocol_path), symbolize_names: true)
FileUtils.mkdir_p(@output_dir)
- browser_protocol[:domains].each(&method(:process_domain))
- js_protocol[:domains].each(&method(:process_domain))
+ browser_protocol[:domains].each { |domain| process_domain(domain) }
+ js_protocol[:domains].each { |domain| process_domain(domain) }
require_file
end
def process_domain(domain)
result = @template.result_with_hash(domain: domain, version: @version.upcase, h: self)
@@ -77,19 +77,19 @@
end
parameters.join(', ')
end
def remove_empty_lines(string)
- string.split("\n").reject { |l| l =~ /^\s+$/ }.join("\n")
+ string.split("\n").grep_v(/^\s+$/).join("\n")
end
def require_file
# rubocop:disable Lint/InterpolationCheck
dynamic_location = '#{File.dirname(File.absolute_path(__FILE__))}'
# rubocop:enable Lint/InterpolationCheck
require_all = "Dir.glob(\"#{dynamic_location}/#{@version}/*\", &method(:require))"
- File.open(@loader_path, 'w') { |file| file.write(require_all) }
+ File.write(@loader_path, require_all)
end
end
end
end
end