1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rdoc] Prefer require 'cgi/util' instead of require 'cgi'

RDoc is using only CGI.escape, escapeHTML, and unescape.
We don't have to load the whole source code of cgi gem.

https://github.com/ruby/rdoc/commit/d096222cc2
This commit is contained in:
Yusuke Endoh 2022-02-20 20:45:53 +09:00 committed by git
parent a49aae2c5e
commit ae8a8b184e
5 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'cgi'
## ##
# A Context is something that can hold modules, classes, methods, attributes, # A Context is something that can hold modules, classes, methods, attributes,
# aliases, requires, and includes. Classes, modules, and files are all # aliases, requires, and includes. Classes, modules, and files are all

View file

@ -1,4 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'cgi/util'
## ##
# A section of documentation like: # A section of documentation like:
# #

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'cgi' require 'cgi/util'
## ##
# Outputs RDoc markup as HTML. # Outputs RDoc markup as HTML.

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'cgi' require 'cgi/util'
## ##
# Creates HTML-safe labels suitable for use in id attributes. Tidylinks are # Creates HTML-safe labels suitable for use in id attributes. Tidylinks are

View file

@ -289,7 +289,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
# HTML id-friendly method/attribute name # HTML id-friendly method/attribute name
def html_name def html_name
require 'cgi' require 'cgi/util'
CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '') CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
end end