diff options
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/renderer/partial_renderer.rb | 12 |
1 files 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 |