# File lib/rdoc/text.rb, line 167
def strip_stars text
return text unless text =~ %/\*.*\*/%
encoding = text.encoding if Object.const_defined? :Encoding
text = text.gsub %Document-method:\s+[\w:.#=!?]+%, ''
space = ' '
space.force_encoding encoding if encoding
text.sub! %/\*+% do space * $&.length end
text.sub! %\*+/% do space * $&.length end
text.gsub! %^[ \t]*\*% do space * $&.length end
empty = ''
empty.force_encoding encoding if encoding
text.gsub(/^\s+$/, empty)
end