From: "alexeymuranov (Alexey Muranov)" Date: 2013-03-02T00:30:27+09:00 Subject: [ruby-core:53073] [ruby-trunk - Feature #7994] Make iterators pass an implicit named parameter `iteration` to the executed block Issue #7994 has been updated by alexeymuranov (Alexey Muranov). =begin As a use case, i wanted to create a pagination navigation element on a web page in ((*Haml*)) template. What i ended up with looks redundant to me. With the suggested feature, i would be able to do: %nav.pagination - [page_ranges_before, page_ranges_after].each do |page_ranges| - unless iteration.first? %span.page.active = active_page - page_ranges.each do |range| - unless iteration.first? %span.ellipsis ��� - range.each do |page| %button.page{ :type => :submit, :name => :page, :value => page } = page =end ---------------------------------------- Feature #7994: Make iterators pass an implicit named parameter `iteration` to the executed block https://bugs.ruby-lang.org/issues/7994#change-37226 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Normal Assignee: Category: Target version: =begin I think it would be nice to be able to write something like this: items.each do |item| unless iteration.first? # do something that is not applicable to the first iteration end # do whatever is to be done to all items end =end -- http://bugs.ruby-lang.org/