Граф коммитов

101 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun b12bd451af [ruby/erb] Let ERB.version just return a version
and deprecate ERB::Revision.

`'$Date::                           $'` has not been working since Git
migration from SVN. I'm sorry.

Because it has been already broken, I'd like to take this opportunity to
make `ERB.version` compatible with `Gem::Version.new`.

https://github.com/ruby/erb/commit/2b4182eb10
2021-01-21 15:26:55 +09:00
Takashi Kokubun 5f7df72b56
[ruby/erb] Unify ERB version definitions
https://github.com/ruby/erb/commit/5df06b8473
2021-01-20 21:43:05 -08:00
Takashi Kokubun 922989fa0f [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
2021-01-21 13:52:02 +09:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
zverok f6f1377a4e Update ERB docs
* Actualize Notes about other templating engines;
* Document #location= method.
2019-10-26 10:24:20 -07:00
nobu b3507bf147 erb.rb: prohibit marshaling [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28 03:46:48 +00:00
k0kubun 1ae3e6f3ce erb.rb: increase warn level only when non-zero safe_level
is given.

This is merging Eric's patch in [Bug #15479] to Ruby 2.6's behavior in r66631.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29 07:26:22 +00:00
k0kubun c02f036090 Revert "erb.rb: print deprecation warning with warn level 1"
This reverts commit b5569b9ab2.

The deprecation is indefinitely postponed.

[Bug #15478]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29 07:11:38 +00:00
k0kubun b5569b9ab2 erb.rb: print deprecation warning with warn level 1
This was planned to be removed in Ruby 2.7 at first, but I changed my
mind to just keep warning it in Ruby 2.7.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-25 13:57:28 +00:00
k0kubun ab5a3db48e erb.rb: warn invalid trim_mode [Misc #15294]
From: Justin Collins <justin@presidentbeef.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-12 00:37:15 +00:00
k0kubun e4e65671f9 erb.rb: relax warn level of ERB.new
I changed my mind and thought branching ERB.new in all libraries is too
hard. Code becomes too ugly. I increased the warn level to 2, and the
old initializer will be removed when Ruby 2.5 becomes EOL.
-S option of erb(1) stays in the same policy: will be removed at Ruby 2.7.

NEWS: note about the direction

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-28 12:12:20 +00:00
kazu 8b9a3eaba6 lib/erb.rb: Add uplevel to warn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-24 08:54:19 +00:00
k0kubun cc777d09f4 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
2018-02-22 13:28:25 +00:00
ko1 c39bdb798d `$SAFE` as a process global state. [Feature #14250]
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to
  `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state.

* vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc`
  objects don't need to keep `$SAFE` at the creation.
  Also make `is_from_method` and `is_lambda` as 1 bit fields.

* cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation.

* eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access
  `vm->safe_level_` directly.

* eval_jump.c: End procs `END{}` doesn't keep `$SAFE`.

* proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c.

* safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes.

* safe.c (safe_setter): use `rb_set_safe_level()`.

* thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`.
  It should be obsolete.

* transcode.c (load_transcoder_entry): `rb_safe_level()` only returns
  0 or 1 so that this check is not needed.

* vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc.

* vm.c (rb_proc_create): renamed to `proc_create`.

* vm.c (rb_proc_dup): moved from proc.c.

* vm.c (vm_invoke_proc): do not need to set and restore `$SAFE`
  for `Proc#call`.

* vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer
  meaning.

* lib/drb/drb.rb: restore `$SAFE`.

* lib/erb.rb: restore `$SAFE`, too.

* test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests.

* test/rubygems/test_gem.rb: do not set `$SAFE = 1`.

* bootstraptest/test_proc.rb: catch up this change.

* spec/ruby/optional/capi/string_spec.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

* test/fiddle/test_func.rb: ditto.

* test/fiddle/test_handle.rb: ditto.

* test/net/imap/test_imap_response_parser.rb: ditto.

* test/pathname/test_pathname.rb: ditto.

* test/readline/test_readline.rb: ditto.

* test/ruby/test_file.rb: ditto.

* test/ruby/test_optimization.rb: ditto.

* test/ruby/test_proc.rb: ditto.

* test/ruby/test_require.rb: ditto.

* test/ruby/test_thread.rb: ditto.

* test/rubygems/test_gem_specification.rb: ditto.

* test/test_tempfile.rb: ditto.

* test/test_tmpdir.rb: ditto.

* test/win32ole/test_win32ole.rb: ditto.

* test/win32ole/test_win32ole_event.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 20:09:24 +00:00
k0kubun 9006d059f4 erb.rb: let's remove constant deprecated at 2.5
(r59497).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 05:07:16 +00:00
k0kubun c46d3de0f5 erb.rb: preserve the behavior for invalid syntax
comment. Fix regression at r58948.

I even don't want to deprecate it because deprecation needs to lex all
embedded Ruby script using Ripper and it would be slow.  So Let me just
keep this behavior of Ruby 2.4. No change is the best compatibility.

This commit stopped using String#-@ because it's harmful for "ambiguous
first argument" warning if we really want to maintain this behavior.

[Bug #14243]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-27 12:40:03 +00:00
nobu 161f4a511a erb.rb: shadow by keys
* lib/erb.rb (ERB#new_toplevel): shadow already defined local
  variables by block local variabes, not to overwrite them.
  [ruby-core:84390] [Bug #14215]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22 08:08:31 +00:00
marcandre 4eac6eb373 lib/erb: Update doc [ci-skip] [doc]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-15 20:15:54 +00:00
k0kubun 774b42d643 erb.rb: specify frozen_string_literal: true
for compilation performance.

$ ruby ./benchmark/driver.rb -e "trunk::/Users/k0kubun/.rbenv/versions/trunk/bin/ruby;modified::/Users/k0kubun/.rbenv/versions/modified/bin/ruby" -d ./benchmark -p app_erb

-----------------------------------------------------------
benchmark results:
Execution time (sec)
name    trunk   modified
app_erb 1.911      1.885

Speedup ratio: compare with the result of `trunk' (greater is better)
name    modified
app_erb    1.014

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:02:46 +00:00
kazu 5723d9fd34 Use unpack1 instead of unpack and `[0]`
[Feature #13943][ruby-core:83027]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-29 11:00:00 +00:00
k0kubun 9d389d6510 erb.rb: drop unreachable method
This seems to be unreachable from first introduction at r21286.

In ERB implementation, `#empty?` is only called for each member of
return value of `String#scan`, and `ERB::Compiler::PercentLine` is never
returned from `String#scan`.

Also, in `ERB::Compiler#compile`, as it's yielded only when stag is nil,
methods called to `ERB::Compiler::PercentLine` object yielded from
`ERB::Compiler::TrimScanner#scan` are only: `#nil?`, `#==`, `to_s`.

Thus `ERB::Compiler::PercentLine#empty?` is never used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-26 11:50:07 +00:00
kazu 01eb8d776b Use `register_scanner` instead of `regist_scanner`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-04 11:59:59 +00:00
kazu 3b1987fb79 Add deprecated warning to ERB::Compiler::SimpleScanner2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-04 11:59:57 +00:00
naruse abbfc048c5 suppress warning: ambiguous first argument; put parentheses or a space even after `-' operator
Introduced at r58905
http://rubyci.s3.amazonaws.com/ubuntu/ruby-trunk/log/20170526T153003Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28 16:41:31 +00:00
k0kubun 2e75043a49 erb.rb: Use str_uplus instead of rb_str_dup
to skip unnecessary string allocation on frozen_string_literal: false.
str_uplus can bypass calling rb_str_dup when OBJ_FROZEN is true.

* Before

erb_render      1.064

* Afete

erb_render      0.909

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 03:06:55 +00:00
k0kubun 43572889b3 erb.rb: Tiny improvement of compiling cost
by reducing string allocation.

* Before

app_erb 0.687

* After

app_erb 0.679

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 14:17:55 +00:00
k0kubun 9f9f8236ff erb.rb: [DOC] Follow compiled code's change
introduced in r58905.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 13:58:36 +00:00
k0kubun 6f685e106c erb.rb: Generate static string with opt_str_uminus
to skip object allocation for static string.

We can't always enable frozen_string_literal pragma because we can't
freeze string literals embedded by user for backward compatibility.
So we need to use fstring for each static string.

Since adding ".freeze" to string literals in #content_dump is slow
on compiling, I used unary "-" operator instead.

benchmark/bm_app_erb_render.rb: Added rendering-only benchmark to
test rendering performance on production environment.

This benchmark is created to reproduce the behavior on Sinatra (Tilt).
Thus it doesn't use ERB#result to skip parsing compiled code.
It doesn't use ERB#def_method too to regard `title` and `content` as
local variables. If we use #def_method, `title` and `content` needs
to be method call. I wanted to avoid it.

This patch's benchmark results is:

* Before

app_erb_render  1.250
app_erb 0.704

* After

app_erb_render  1.066
app_erb 0.686

This patch optimizes rendering performance (app_erb_render) without
spoiling (total of rendering +) compiling performance (app_erb).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 13:49:35 +00:00
k0kubun 5fc3236222 erb.rb: Use script encoding instead of force_encoding
The original intention of introducing `_erbout.force_encoding`
in r21170 was:

- "returns a string in the same character encoding as the input string."
- "When the input string has a magic comment, however, it returns a string
  in the encoding specified by the magic comment."

And they are tested by test/erb/test_erb_m17n.rb well and this patch
passes the test.
Since magic comment is always added in ERB compiled code, using ''.dup
instead of String.new will set correct encoding without calling
force_encoding method.

The benchmark results are:

* Before

$ ./ruby benchmark/run.rb --matzruby=./ruby -m bm_app_erb
MatzRuby:
ruby 2.5.0dev (2017-05-26 skip-force-enc.. 58903) [x86_64-linux]
last_commit=Skip force_encoding in compiled code of erb
Ruby:

app_erb:
matz 0.715

* After

$ ./ruby benchmark/run.rb --matzruby=./ruby -m bm_app_erb
MatzRuby:
ruby 2.5.0dev (2017-05-26 skip-force-enc.. 58903) [x86_64-linux]
last_commit=Skip force_encoding in compiled code of erb
Ruby:

app_erb:
matz 0.672

And perf(1) results are:

* Before

$ sudo perf stat ./ruby benchmark/bm_app_erb.rb

 Performance counter stats for './ruby benchmark/bm_app_erb.rb':

        709.571746      task-clock (msec)         #    1.000 CPUs utilized
                 5      context-switches          #    0.007 K/sec
                 1      cpu-migrations            #    0.001 K/sec
             1,337      page-faults               #    0.002 M/sec
     3,088,936,521      cycles                    #    4.353 GHz
   <not supported>      stalled-cycles-frontend
   <not supported>      stalled-cycles-backend
     4,849,564,282      instructions              #    1.57  insns per cycle
     1,027,042,087      branches                  # 1447.411 M/sec
        19,983,456      branch-misses             #    1.95% of all branches

       0.709747823 seconds time elapsed

* After

$ sudo perf stat ./ruby benchmark/bm_app_erb.rb

 Performance counter stats for './ruby benchmark/bm_app_erb.rb':

        693.494673      task-clock (msec)         #    1.000 CPUs utilized
                 7      context-switches          #    0.010 K/sec
                 1      cpu-migrations            #    0.001 K/sec
             1,316      page-faults               #    0.002 M/sec
     3,025,639,349      cycles                    #    4.363 GHz
   <not supported>      stalled-cycles-frontend
   <not supported>      stalled-cycles-backend
     4,694,848,271      instructions              #    1.55  insns per cycle
       994,496,704      branches                  # 1434.037 M/sec
        19,693,239      branch-misses             #    1.98% of all branches

       0.693724345 seconds time elapsed

[fix GH-1147]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 12:12:13 +00:00
k0kubun eb1652b571 erb.rb: Add ERB#result_with_hash
[ruby-core:55985] [Feature #8631] [fix GH-1623]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 15:38:25 +00:00
k0kubun 72fb1e1690 erb.rb: Skip creating regexp
if stags and etags are not changed from default.

:putobject insn (of regexp) will be used instead of :toregexp insn.
This means that the regexp won't be compiled for every
`SimpleScanner#scan` call.

It may not be a good idea to apply this kind of optimization for all cases.
But I applied this because it is default scanner and used frequently and has
relatively large impact for benchmark like this:

* Before
app_erb 1.023

* After
app_erb 0.781

This commit fixes only the bottleneck of performance regression introduced
in r53412. For maintainability, I won't fix other small regressions like
additional overhead of method calls.

[ruby-core:73820] [Bug #12074]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 03:56:16 +00:00
k0kubun 64c914706e erb.rb: Allow trimming CR in all trim_modes
to unify a behavior with r58823 and r58825.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:36:09 +00:00
k0kubun b82ed2ce61 erb.rb: Allow explicit trimming carriage return
when trim_mode is "-", for Windows environments.

[ruby-core:39625] [Bug #5339]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:17:22 +00:00
k0kubun 040f275690 erb.rb: Allow trimming carriage return
when trim_mode is "<>", for Windows environments.

[Bug #11464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 16:50:33 +00:00
k0kubun a6986f10d0 erb.rb: Prevent potential unexpected rescue
of LoadError in some method calls, not from `require "strscan"`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 16:20:07 +00:00
k0kubun ca34d7075a erb.rb: Drop unused scanner implementation
Original `SimpleScanner` was used only in tests.
Since `SimpleScanner` and `SimpleScanner2` work in the same way, I want
to drop the one which can't be used in a normal situation.

The only difference was `SimpleScanner` can be loaded without strscan
dependency but I think there's no situation that strscan is unavailable
because it's a standard library.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 14:55:33 +00:00
k0kubun 53127c2410 erb.rb: Don't encode tilde in #url_encode
Based on patch by madeofcode (Mark Dodwell).
[ruby-core:46168] [Bug #6696] [Fix GH-54]

`~` is a unreserved character.
https://tools.ietf.org/html/rfc3986#section-2.3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 11:58:09 +00:00
k0kubun 52c738408e erb.rb: Use String#<< instead of #concat
to optimize String concatenation on rendering.

[fix GH-1612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-15 13:38:02 +00:00
a_matsuda 051ba7b0b4 Alias regist_scanner to register_scanner
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 16:56:52 +00:00
nobu 76a3f0ca2e remove unnecessary :stag accessor
* lib/erb.rb (ERB::Compiler::TrimScanner#stag): The :stag accessor
  has already been available because it is defined in parent
  Scanner class.  [Fix GH-1445]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-25 13:48:08 +00:00
nobu 4f8245b703 erb.rb: fronzen-string-literal in comment [Fix GH-1229]
* lib/erb.rb (ERB::Compiler#detect_magic_comment): allow
  fronzen-string-literal in comment as well as encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 05:16:29 +00:00
nobu 708a982cb4 erb.rb: duplicated magic comments [Fix GH-1229]
* lib/erb.rb (ERB#def_method): insert def line just before the
  first non-comment and non-empty line, not to leave duplicated
  and stale magic comments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 05:14:31 +00:00
nobu c55ad90a6e erb.rb: frozen-string-literal safe
* lib/erb.rb (ERB#set_eoutvar): explicitly make mutable string as
  a buffer to make ERB work with --enable-frozen-string-literal.
  [ruby-core:73561] [Bug #12031]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 02:14:36 +00:00
seki 32b4a8b36b Allow ERB subclass to add token easily. [Feature #11936]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02 07:19:58 +00:00
hsbt 0516a3378f * lib/erb.rb: revert r53123. It break compatibility like thor and rspec-rails.
We should try with Ruby 2.4 or 3.0.
  [Bug #11842][ruby-core:72374]
* lib/rdoc/erb_partial.rb: ditto.
* template/verconf.h.tmpl: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20 06:36:57 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt ec7a964dca * lib/erb.rb: Render erb with array buffer for function call optimization.
[fix GH-1143]
* lib/rdoc/erb_partial.rb: ditto.
* template/verconf.h.tmpl: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 07:20:07 +00:00
hsbt 1178a6fdba * lib/erb.rb: Simplify regexp to optimize erb scanner.
[fix GH-1144]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 03:20:36 +00:00
nobu 9e52416cd3 erb: set variables from the command line
* bin/erb (ARGV.switch, ERB::Main#run): allow variables to be set
  from the command line.  [ruby-core:65772] [Feature #10395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12 10:48:57 +00:00
nobu e82f4195d4 erb: lineno and location setters
* lib/erb.rb (ERB#lineno): accessor for line number to eval.
* lib/erb.rb (ERB#location=): setter of file name and line number.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12 10:31:47 +00:00