ruby-changes:54343
From: k0kubun <ko1@a...>
Date: Tue, 25 Dec 2018 22:57:33 +0900 (JST)
Subject: [ruby-changes:54343] k0kubun:r66556 (trunk): erb.rb: print deprecation warning with warn level 1
k0kubun 2018-12-25 22:57:28 +0900 (Tue, 25 Dec 2018) New Revision: 66556 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66556 Log: erb.rb: print deprecation warning with warn level 1 This was planned to be removed in Ruby 2.7 at first, but I changed my mind to just keep warning it in Ruby 2.7. Modified files: trunk/lib/erb.rb trunk/test/erb/test_erb.rb Index: lib/erb.rb =================================================================== --- lib/erb.rb (revision 66555) +++ lib/erb.rb (revision 66556) @@ -812,18 +812,18 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L812 # A well messages pattie, breaded and fried. # 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. + # Complex initializer for $SAFE deprecation at [Feature #14256], which should be removed at a version later than 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 if $VERBOSE + 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 '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 + 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 'Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.', uplevel: 1 if $VERBOSE + 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.rb =================================================================== --- test/erb/test_erb.rb (revision 66555) +++ test/erb/test_erb.rb (revision 66556) @@ -24,7 +24,7 @@ class TestERB < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb.rb#L24 assert_match(/\Atest filename:1\b/, e.backtrace[0]) end - # [deprecated] This will be removed at Ruby 2.7 + # [deprecated] This will be removed later than Ruby 2.7 def test_without_filename_with_safe_level erb = EnvUtil.suppress_warning do ERB.new("<% raise ::TestERB::MyError %>", 1) @@ -35,7 +35,7 @@ class TestERB < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb.rb#L35 assert_match(/\A\(erb\):1\b/, e.backtrace[0]) end - # [deprecated] This will be removed at Ruby 2.7 + # [deprecated] This will be removed later than Ruby 2.7 def test_with_filename_and_safe_level erb = EnvUtil.suppress_warning do ERB.new("<% raise ::TestERB::MyError %>", 1) @@ -98,7 +98,7 @@ class TestERBCore < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb.rb#L98 end def test_core - # [deprecated] Fix initializer at Ruby 2.7 + # [deprecated] Fix initializer later than Ruby 2.7 EnvUtil.suppress_warning do _test_core(nil) _test_core(0) @@ -661,7 +661,7 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb.rb#L661 end end - # These interfaces will be removed at Ruby 2.7. + # These interfaces will be removed later than Ruby 2.7. def test_deprecated_interface_warnings [nil, 0, 1, 2].each do |safe| assert_warning(/2nd argument of ERB.new is deprecated/) do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/