def wrap(s, width=78) s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")endpoetry = %q{It is an ancient Mariner,A"}puts wrap(poetry, 20)