summaryrefslogtreecommitdiff
path: root/lib/erb.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-01-20 20:45:55 -0800
committergit <svn-admin@ruby-lang.org>2021-01-21 13:52:02 +0900
commit922989fa0f1bf1e13b2c9bf1c8d6ad9459c798f6 (patch)
tree2b2897dcf06acc556550415d31725e3e6721be89 /lib/erb.rb
parent47b43807a86bd29e4e275aaf23228cd78adf696e (diff)
[ruby/erb] Warn safe_level and later args even without -w
because, when Ruby 3.1 is released, Ruby 2.5, the last version with the old method signature, will have been EOL. Therefore we can safely warn the old interface from Ruby 3.1. https://github.com/ruby/erb/commit/c3a753f49f
Diffstat (limited to 'lib/erb.rb')
-rw-r--r--lib/erb.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/erb.rb b/lib/erb.rb
index d2ea64ab60..f8533efda9 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -809,14 +809,14 @@ 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 || !ZERO_SAFE_LEVELS.include?(safe_level)
+ 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
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
@@ -829,8 +829,6 @@ 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