Skip to content

Commit 92fde7e

Browse files
committed
Drop deprecated -S option from erb command
We attempted to remove things like this and reverted all of them, but I think nobody relies on this unlike the positional arguments of `ERB#initialize`.
1 parent cfae15a commit 92fde7e

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## Unreleased
4+
5+
- Drop deprecated `-S` option from `erb` command
6+
37
## 3.0.0
48

59
- Bump `required_ruby_version` to Ruby 2.7+ [#23](https://github.com/ruby/erb/pull/23)

libexec/erb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ class ERB
7474
$DEBUG = true
7575
when '-r' # require
7676
require ARGV.req_arg
77-
when '-S' # security level
78-
warn 'warning: -S option of erb command is deprecated. Please do not use this.'
79-
arg = ARGV.req_arg
80-
raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-1]\z/
81-
safe_level = arg.to_i
8277
when '-T' # trim mode
8378
arg = ARGV.req_arg
8479
if arg == '-'
@@ -127,12 +122,7 @@ EOU
127122
filename = $FILENAME
128123
exit 2 unless src
129124
trim = trim_mode_opt(trim_mode, disable_percent)
130-
if safe_level.nil?
131-
erb = factory.new(src, trim_mode: trim)
132-
else
133-
# [deprecated] This will be removed at Ruby 2.7.
134-
erb = factory.new(src, safe_level, trim_mode: trim)
135-
end
125+
erb = factory.new(src, trim_mode: trim)
136126
erb.filename = filename
137127
if output
138128
if number

test/erb/test_erb_command.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,4 @@ def test_template_file_encoding
1717
File.expand_path("../../libexec/erb", __dir__)],
1818
"<%=''.encoding.to_s%>", ["UTF-8"])
1919
end
20-
21-
# These interfaces will be removed at Ruby 2.7.
22-
def test_deprecated_option
23-
pend if RUBY_ENGINE == 'truffleruby'
24-
warnings = [
25-
"warning: -S option of erb command is deprecated. Please do not use this.",
26-
/\n.+\/libexec\/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/,
27-
]
28-
assert_in_out_err(["-I#{File.expand_path('../../lib', __dir__)}",
29-
File.expand_path("../../libexec/erb", __dir__),
30-
"-S", "0"],
31-
"hoge", ["hoge"], warnings)
32-
end
3320
end

0 commit comments

Comments
 (0)