[前][次][番号順一覧][スレッド一覧]

ruby-changes:50480

From: k0kubun <ko1@a...>
Date: Wed, 28 Feb 2018 21:12:28 +0900 (JST)
Subject: [ruby-changes:50480] k0kubun:r62612 (trunk): erb.rb: relax warn level of ERB.new

k0kubun	2018-02-28 21:12:20 +0900 (Wed, 28 Feb 2018)

  New Revision: 62612

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62612

  Log:
    erb.rb: relax warn level of ERB.new
    
    I changed my mind and thought branching ERB.new in all libraries is too
    hard. Code becomes too ugly. I increased the warn level to 2, and the
    old initializer will be removed when Ruby 2.5 becomes EOL.
    -S option of erb(1) stays in the same policy: will be removed at Ruby 2.7.
    
    NEWS: note about the direction

  Modified files:
    trunk/NEWS
    trunk/lib/erb.rb
Index: lib/erb.rb
===================================================================
--- lib/erb.rb	(revision 62611)
+++ lib/erb.rb	(revision 62612)
@@ -805,16 +805,16 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L805
   def initialize(str, safe_level=NOT_GIVEN, legacy_trim_mode=NOT_GIVEN, legacy_eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: '_erbout')
     # Complex initializer for $SAFE deprecation at Feature #14256, which should be removed at Ruby 2.7.
     if safe_level != NOT_GIVEN
-      warn 'Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.', uplevel: 1
+      warn 'Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.', uplevel: 1 if $VERBOSE
     else
       safe_level = nil
     end
     if legacy_trim_mode != NOT_GIVEN
-      warn 'Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.', uplevel: 1
+      warn 'Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.', uplevel: 1 if $VERBOSE
       trim_mode = legacy_trim_mode
     end
     if legacy_eoutvar != NOT_GIVEN
-      warn 'Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.', uplevel: 1
+      warn 'Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.', uplevel: 1 if $VERBOSE
       eoutvar = legacy_eoutvar
     end
 
Index: NEWS
===================================================================
--- NEWS	(revision 62611)
+++ NEWS	(revision 62612)
@@ -97,8 +97,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L97
 
 * ERB
 
-  * 2nd, 3rd and 4th arguments of ERB.new are deprecated. 2nd argument (safe_level) will be dropped in the future
-    and some of those arguments (trim_mode, eoutvar) are changed to keyword arguments. [Feature #14256]
+  * Add :trim_mode and :eoutvar keyword arguments to ERB.new. Now non-keyword arguments other than first one
+    are softly deprecated and will be removed when Ruby 2.5 becomes EOL.
+
+  * erb command's -S option is deprecated, which will be removed in the next version.
 
 * Matrix
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]