I need to split a string and print it beginning from bottom on my views. The standard way starts reading string from the beginning and prints accordingly. How do I reverse it?
<% @a[:log].to_s.split(/----/).each do |line| %>
<div width='100%'><pre class="log"><%= "#{line}" %></pre></div>
<% end %>
@a[:log] is a string something like this: One ---- Two ---- Three ---- Four
I want this printed reverse starting from Four, instead of One.
<div width='100%'><pre class="log">Four</pre></div>
<div width='100%'><pre class="log">Three</pre></div>
<div width='100%'><pre class="log">Two</pre></div>
<div width='100%'><pre class="log">One</pre></div>
Instead of:
Do: