From 7dc0f3fc8d3160db3408ef5a20c43a7268c0cd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 16 Jul 2014 14:38:07 -0300 Subject: [PATCH] Document the PartialIteration object --- .../lib/action_view/renderer/partial_renderer.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index bc0215b6c6..eb8db16796 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -1,23 +1,29 @@ require 'thread_safe' module ActionView - class PartialIteration # :nodoc: - attr_reader :size, :index + class PartialIteration + # The number of iterations that will be done by the partial. + attr_reader :size + + # The current iteration of the partial. + attr_reader :index def initialize(size) @size = size @index = 0 end + # Check if this is the first iteration of the partial. def first? index == 0 end + # Check if this is the last iteration of the partial. def last? index == size - 1 end - def iterate! + def iterate! # :nodoc: @index += 1 end end