[前][次][番号順一覧][スレッド一覧]

ruby-changes:56701

From: Kazuhiro <ko1@a...>
Date: Tue, 30 Jul 2019 13:15:29 +0900 (JST)
Subject: [ruby-changes:56701] Kazuhiro NISHIYAMA: 2e6f777f9e (master): `/o` should not use with instance variable

https://git.ruby-lang.org/ruby.git/commit/?id=2e6f777f9e

From 2e6f777f9efa8ba15dcd1b7c1bb1917e5d31d6f8 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Tue, 30 Jul 2019 12:44:38 +0900
Subject: `/o` should not use with instance variable

for example:
```
class C;def initialize(pat);@pat=pat;end;def re;/#{@pat}/o;end;end
C.new('1').re #=> /1/
C.new('2').re #=> /1/
```

diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index 1fd9a62..e1d0f0c 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -112,7 +112,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet https://github.com/ruby/ruby/blob/trunk/lib/rdoc/servlet.rb#L112
   # GET request entry point.  Fills in +res+ for the path, etc. in +req+.
 
   def do_GET req, res
-    req.path.sub!(/\A#{Regexp.escape @mount_path}/o, '') if @mount_path
+    req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path
 
     case req.path
     when '/' then
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]