mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import RDoc 3.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
90d5bcf910
commit
e2efe8e81d
28 changed files with 494 additions and 56 deletions
|
@ -60,8 +60,6 @@ module RDoc::Encoding
|
|||
# Sets the encoding of +string+ based on the magic comment
|
||||
|
||||
def self.set_encoding string
|
||||
return unless Object.const_defined? :Encoding
|
||||
|
||||
first_line = string[/\A(?:#!.*\n)?.*\n/]
|
||||
|
||||
name = case first_line
|
||||
|
@ -70,6 +68,10 @@ module RDoc::Encoding
|
|||
else return
|
||||
end
|
||||
|
||||
string.sub! first_line, ''
|
||||
|
||||
return unless Object.const_defined? :Encoding
|
||||
|
||||
enc = Encoding.find name
|
||||
string.force_encoding enc if enc
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue