Skip to content

Instantly share code, notes, and snippets.

@dekart
Created July 26, 2010 16:14
Show Gist options
  • Select an option

  • Save dekart/490772 to your computer and use it in GitHub Desktop.

Select an option

Save dekart/490772 to your computer and use it in GitHub Desktop.
def group_header(text, group_name = :main, &block)
@group_headers ||= {}
if @group_headers[group_name] != text
@group_headers[group_name] = text
block_given? ? yield(text) : text
end
end
<% words.each do |word| %>
<% group_header word.mb_chars.first do |letter| %>
Тут выводим заголовок группы
<% end %>
Тут выводим элемент группы
<% end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment