Title: [290718] trunk/Source/WebCore
Revision
290718
Author
[email protected]
Date
2022-03-01 22:03:13 -0800 (Tue, 01 Mar 2022)

Log Message

Fix deprecations for ERB.new in GenerateSettings.rb
https://bugs.webkit.org/show_bug.cgi?id=237237

Reviewed by Don Olmstead.

Ruby 3.1.0 reported the following warning:
> GenerateSettings.rb:283: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
> GenerateSettings.rb:283: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.

r290104 and r290331 fixed the same problem for
GeneratePreferences.rb, but forgot GenerateSettings.rb.

* Scripts/GenerateSettings.rb: Use the keyword argument for ERB.new for Ruby 2.6+.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290717 => 290718)


--- trunk/Source/WebCore/ChangeLog	2022-03-02 03:42:31 UTC (rev 290717)
+++ trunk/Source/WebCore/ChangeLog	2022-03-02 06:03:13 UTC (rev 290718)
@@ -1,3 +1,19 @@
+2022-03-01  Fujii Hironori  <[email protected]>
+
+        Fix deprecations for ERB.new in GenerateSettings.rb
+        https://bugs.webkit.org/show_bug.cgi?id=237237
+
+        Reviewed by Don Olmstead.
+
+        Ruby 3.1.0 reported the following warning:
+        > GenerateSettings.rb:283: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
+        > GenerateSettings.rb:283: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
+
+        r290104 and r290331 fixed the same problem for
+        GeneratePreferences.rb, but forgot GenerateSettings.rb.
+
+        * Scripts/GenerateSettings.rb: Use the keyword argument for ERB.new for Ruby 2.6+.
+
 2022-03-01  Andres Gonzalez  <[email protected]>
 
         Unnecessary copy of Vector of children IDs in AXIsolatedTree::updateChildren.

Modified: trunk/Source/WebCore/Scripts/GenerateSettings.rb (290717 => 290718)


--- trunk/Source/WebCore/Scripts/GenerateSettings.rb	2022-03-02 03:42:31 UTC (rev 290717)
+++ trunk/Source/WebCore/Scripts/GenerateSettings.rb	2022-03-02 06:03:13 UTC (rev 290718)
@@ -280,7 +280,11 @@
   def renderTemplate(template, outputDirectory)
     file = File.join(outputDirectory, File.basename(template, ".erb"))
 
-    output = ERB.new(File.read(template), 0, "-").result(binding)
+    if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
+        output = ERB.new(File.read(template), trim_mode:"-").result(binding)
+    else
+        output = ERB.new(File.read(template), 0, "-").result(binding)
+    end
     File.open(file, "w+") do |f|
       f.write(output)
     end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to