Issue #14256 has been updated by k0kubun (Takashi Kokubun).


I forgot to have a link to this ticket in r62612. 

Ruby 2.5's ERB.new interface will continue to be available until Ruby 2.5 becomes EOL. So you don't need to branch ERB.new usage in many places. The deprecation warning is shown only when "-w" (or "-W2") flag is explicitly added.

If you're even against having deprecation warning on warn level 2, please add comments here. I may postpone it.

----------------------------------------
Feature #14256: Deprecate $SAFE support in ERB and let ERB.new take keyword arguments for it
https://bugs.ruby-lang.org/issues/14256#change-70718

* Author: k0kubun (Takashi Kokubun)
* Status: Closed
* Priority: Normal
* Assignee: k0kubun (Takashi Kokubun)
* Target version: 2.6
----------------------------------------
See https://bugs.ruby-lang.org/issues/14250.

Proc-level $SAFE change does no longer make sense. This should be deprecated and then removed. But the problem is that the position of safe_level argument is in the middle of argument list of ERB#initialize.
 
So to remove it safely, we should make them keyword arguments and deprecate the current non-keyword-argument interface. Having both interfaces would be backward-compatible because all of arguments don't take {}.
 
## before
```
ERB.new("<%= 'foo' %>", 1, '%', '_erbout')
```
 
## after
```
ERB.new("<%= 'foo' %>", 1, '%', '_erbout') # print deprecation in 2.6 if argc >= 2, and removed in later version
ERB.new("<%= 'foo' %>", trim_mode: '%', eoutvar: '_erbout') # no safe_level support from first
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>