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

ruby-changes:56695

From: Nobuyoshi <ko1@a...>
Date: Mon, 29 Jul 2019 23:08:48 +0900 (JST)
Subject: [ruby-changes:56695] Nobuyoshi Nakada: e62a60927e (master): Should match the beginning/end of string

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

From e62a60927e5477380db34c381e142bce812232dd Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 29 Jul 2019 22:56:48 +0900
Subject: Should match the beginning/end of string


diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index 0ff83fd..1fd9a62 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!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path
+    req.path.sub!(/\A#{Regexp.escape @mount_path}/o, '') if @mount_path
 
     case req.path
     when '/' then
@@ -150,9 +150,9 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet https://github.com/ruby/ruby/blob/trunk/lib/rdoc/servlet.rb#L150
 
     if klass = store.find_class_or_module(name) then
       res.body = generator.generate_class klass
-    elsif page = store.find_text_page(name.sub(/_([^_]*)$/, '.\1')) then
+    elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then
       res.body = generator.generate_page page
-    elsif page = store.find_text_page(text_name.sub(/_([^_]*)$/, '.\1')) then
+    elsif page = store.find_text_page(text_name.sub(/_([^_]*)\z/, '.\1')) then
       res.body = generator.generate_page page
     else
       not_found generator, req, res
@@ -419,7 +419,7 @@ version.  If you're viewing Ruby's documentation, include the version of ruby. https://github.com/ruby/ruby/blob/trunk/lib/rdoc/servlet.rb#L419
       RDoc::Store.new RDoc::RI::Paths.system_dir, :system
     when 'site' then
       RDoc::Store.new RDoc::RI::Paths.site_dir, :site
-    when /^extra-(\d+)$/ then
+    when /\Aextra-(\d+)\z/ then
       index = $1.to_i - 1
       ri_dir = installed_docs[index][4]
       RDoc::Store.new ri_dir, :extra
-- 
cgit v0.10.2


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

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