On Dec 13, 2007, at 6:52 PM, jackster the jackle wrote:

> Thanks for all the help everyone. Someone from the rails forum gave me
> what seems like the simplest solution...here's what he wrote:
>
> The problem you have is an HTML one, not a ruby one.
>
> Basically, HTML ignores a \n unless it is inside a <pre> </pre> tag.
>
> So, you can do this instead:
>
> <pre>
> <%= processes %>
> </pre>
> And it should work fine.
>
> Also your Ruby code can be just:
>
> def processes
> `ps -el`
> end
>
> To get the same result.  You don't need all that splitting or
> assignments or even return command.
While using <pre> elements to preserve whitespace is simple it also  
is not entirely consistent.
Remember you are dealing with different user-agents (browsers) on  
different platforms.
Particularly, tab characters (that may be generated by some command- 
line tool output) may be displayed at different widths depending on  
the user-agent and/or the system.
the <pre> element is a useful one but its implementations will not be  
as predictable for rendering by the user-agent as going back and  
breaking that output into some parts to populate some kind of table  
or div structure.

Some tools do not produce \n endings even, just relying on terminal  
window for line-wrapping...