Module | Merb::Helpers::Text |
In: |
lib/merb-helpers/text_helpers.rb
|
Allows you to cycle through elements in an array
values<Array>: | Array of objects to cycle through |
values<Hash>: | Last element of array can be a hash with the key of :name to specify the name of the cycle |
<%= 5.times { cycle("odd! ","even! "} %>
Generates:
odd! even! odd! even! odd!
Allows you to reset a cycle
name<Symbol|String>: | Name of the cycle |
True if successful, otherwise nil
<%= cycle("odd! ","even! ","what comes after even?") %> <%= cycle("odd! ","even! ","what comes after even?") %> <% reset_cycle %> <%= cycle("odd! ","even! ","what comes after even?") %>
Generates:
odd! even! odd!