Skip to content

Commit 4ff1c15

Browse files
k0kubunhsbt
authored andcommitted
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
1 parent 866bf0d commit 4ff1c15

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/rdoc/erbio.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ class RDoc::ERBIO < ERB
2121
# Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
2222

2323
def initialize str, safe_level = nil, trim_mode = nil, eoutvar = 'io'
24-
super
24+
if RUBY_VERSION >= '2.6'
25+
super(str, trim_mode: trim_mode, eoutvar: eoutvar)
26+
else
27+
super
28+
end
2529
end
2630

2731
##

lib/rdoc/generator/darkfish.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,11 @@ def template_for file, page = true, klass = ERB
778778
erbout = "_erbout_#{file_var}"
779779
end
780780

781-
template = klass.new template, nil, '<>', erbout
781+
if RUBY_VERSION >= '2.6'
782+
template = klass.new template, trim_mode: '<>', eoutvar: erbout
783+
else
784+
template = klass.new template, nil, '<>', erbout
785+
end
782786
@template_cache[file] = template
783787
template
784788
end

0 commit comments

Comments
 (0)