summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-22 13:28:25 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-22 13:28:25 (GMT)
commitcc777d09f44fa909a336ba14f3aa802ffe16e010 (patch)
treef360ca1bfed187f981397f6c7370360287606ffb /bin
parent1727c8358498054428a376b52869983549f62399 (diff)
erb.rb: deprecate safe_level of ERB.new
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments (trim_mode, eoutvar) are changed to keyword arguments. Old ways to specify arguments are deprecated and warned now. bin/erb: deprecate -S option. We'll remove all of deprecated ones at Ruby 2.7+. enc/make_encmake.rb: stopped using deprecated interface ext/etc/mkconstants.rb: ditto ext/socket/mkconstants.rb: ditto sample/ripper/ruby2html.rb: ditto spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto spec/ruby/library/erb/new_spec.rb: ditto test/erb/test_erb.rb: ditto test/erb/test_erb_command.rb: ditto tool/generic_erb.rb: ditto tool/ruby_vm/helpers/dumper.rb: ditto tool/transcode-tblgen.rb: ditto lib/rdoc/erbio.rb: ditto lib/rdoc/generator/darkfish.rb: ditto [Feature #14256] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bin')
-rwxr-xr-xbin/erb9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/erb b/bin/erb
index 86f7042..d060cab 100755
--- a/bin/erb
+++ b/bin/erb
@@ -75,6 +75,7 @@ class ERB
when '-r' # require
require ARGV.req_arg
when '-S' # security level
+ warn 'warning: -S option of erb command is deprecated. Please do not use this.'
arg = ARGV.req_arg
raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-1]\z/
safe_level = arg.to_i
@@ -112,7 +113,6 @@ class ERB
-v enable verbose mode
-d set $DEBUG to true
-r library load a library
- -S safe_level set $SAFE (0..1)
-E ex[:in] set default external/internal encodings
-U set default encoding to UTF-8.
-T trim_mode specify trim_mode (0..2, -)
@@ -127,7 +127,12 @@ EOU
filename = $FILENAME
exit 2 unless src
trim = trim_mode_opt(trim_mode, disable_percent)
- erb = factory.new(src.untaint, safe_level, trim)
+ if safe_level.nil?
+ erb = factory.new(src.untaint, trim_mode: trim)
+ else
+ # [deprecated] This will be removed at Ruby 2.7.
+ erb = factory.new(src.untaint, safe_level, trim_mode: trim)
+ end
erb.filename = filename
if output
if number