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

ruby-changes:50443

From: kazu <ko1@a...>
Date: Sat, 24 Feb 2018 17:54:25 +0900 (JST)
Subject: [ruby-changes:50443] kazu:r62563 (trunk): lib/erb.rb: Add uplevel to warn

kazu	2018-02-24 17:54:19 +0900 (Sat, 24 Feb 2018)

  New Revision: 62563

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

  Log:
    lib/erb.rb: Add uplevel to warn

  Modified files:
    trunk/lib/erb.rb
    trunk/test/erb/test_erb_command.rb
Index: lib/erb.rb
===================================================================
--- lib/erb.rb	(revision 62562)
+++ lib/erb.rb	(revision 62563)
@@ -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 'warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.'
+      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
     else
       safe_level = nil
     end
     if legacy_trim_mode != NOT_GIVEN
-      warn 'warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.'
+      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
       trim_mode = legacy_trim_mode
     end
     if legacy_eoutvar != NOT_GIVEN
-      warn 'warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.'
+      warn 'Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.', uplevel: 1
       eoutvar = legacy_eoutvar
     end
 
Index: test/erb/test_erb_command.rb
===================================================================
--- test/erb/test_erb_command.rb	(revision 62562)
+++ test/erb/test_erb_command.rb	(revision 62563)
@@ -20,7 +20,7 @@ class TestErbCommand < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb_command.rb#L20
   def test_deprecated_option
     warnings = [
       "warning: -S option of erb command is deprecated. Please do not use this.",
-      "warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.",
+      /\n.+\/bin\/erb:\d+: warning: Passing safe_level with the 2nd argument of ERB\.new is deprecated\. Do not use it, and specify other arguments as keyword arguments\.\n/,
     ]
     assert_in_out_err(["-w",
                        File.expand_path("../../../bin/erb", __FILE__),

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

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