diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-29 07:26:22 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-29 07:26:22 +0000 |
commit | 1ae3e6f3ce9f16c49d0584e0ad3dc3e709cc4a81 (patch) | |
tree | dc5b13aadde4529e619894d9826849c97b3f243c /lib | |
parent | c02f03609036ba4e815c2ed67fa002492b39dda9 (diff) | |
download | ruby-1ae3e6f3ce9f16c49d0584e0ad3dc3e709cc4a81.tar.gz |
erb.rb: increase warn level only when non-zero safe_level
is given.
This is merging Eric's patch in [Bug #15479] to Ruby 2.6's behavior in r66631.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/erb.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/erb.rb b/lib/erb.rb index 43498cc106..2adc5e0e58 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -814,7 +814,7 @@ class ERB 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]. Use keyword arguments to pass trim_mode or eoutvar. 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 if $VERBOSE || !ZERO_SAFE_LEVELS.include?(safe_level) else safe_level = nil end @@ -836,6 +836,8 @@ class ERB end NOT_GIVEN = Object.new private_constant :NOT_GIVEN + ZERO_SAFE_LEVELS = [0, nil] + private_constant :ZERO_SAFE_LEVELS ## # Creates a new compiler for ERB. See ERB::Compiler.new for details |