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

* lib/rdoc.rb: Updated to RDoc 3.6

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-05-14 00:39:16 +00:00
parent fe89874540
commit 0b6da24a5e
28 changed files with 593 additions and 97 deletions

View file

@ -61,25 +61,17 @@ module RDoc::Text
# Flush +text+ left based on the shortest line
def flush_left text
indents = []
indent = 9999
text.each_line do |line|
indents << (line =~ /[^\s]/ || 9999)
line_indent = line =~ /\S/ || 9999
indent = line_indent if indent > line_indent
end
indent = indents.min
flush = []
empty = ''
empty.force_encoding text.encoding if Object.const_defined? :Encoding
text.each_line do |line|
line[/^ {0,#{indent}}/] = empty
flush << line
end
flush.join
text.gsub(/^ {0,#{indent}}/, empty)
end
##