strip_newlines(text)
Strips leading and trailing n characters from text
# File lib/rdoc/text.rb, line 160 def strip_newlines text text.gsub(/\A\n*(.*?)\n*\z/) do $1 end # block preserves String encoding end