Sync RDoc 6.14.0

This commit is contained in:
Stan Lo 2025-05-22 22:49:04 +01:00 committed by Takashi Kokubun
parent ca1ea95784
commit 03eb777c69
185 changed files with 2008 additions and 1655 deletions

View file

@ -29,7 +29,7 @@ module RDoc::Encoding
# If +force_transcode+ is true the document will be transcoded and any
# unknown character in the target encoding will be replaced with '?'
def self.read_file filename, encoding, force_transcode = false
def self.read_file(filename, encoding, force_transcode = false)
content = File.open filename, "rb" do |f| f.read end
content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
@ -89,7 +89,7 @@ module RDoc::Encoding
##
# Detects the encoding of +string+ based on the magic comment
def self.detect_encoding string
def self.detect_encoding(string)
result = HEADER_REGEXP.match string
name = result && result[:name]
@ -99,7 +99,7 @@ module RDoc::Encoding
##
# Removes magic comments and shebang
def self.remove_magic_comment string
def self.remove_magic_comment(string)
string.sub HEADER_REGEXP do |s|
s.gsub(/[^\n]/, '')
end
@ -109,7 +109,7 @@ module RDoc::Encoding
# Changes encoding based on +encoding+ without converting and returns new
# string
def self.change_encoding text, encoding
def self.change_encoding(text, encoding)
if text.kind_of? RDoc::Comment
text.encode! encoding
else