diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-16 14:38:07 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-16 14:54:23 -0300 |
commit | 7dc0f3fc8d3160db3408ef5a20c43a7268c0cd8e (patch) | |
tree | 6fca7dead1cbe00ba10b16ef7c0e6b4249170121 /actionview/lib/action_view | |
parent | 9290fc5ce213836f666a97e0e458d98e69a920ac (diff) | |
download | rails-7dc0f3fc8d3160db3408ef5a20c43a7268c0cd8e.tar.gz rails-7dc0f3fc8d3160db3408ef5a20c43a7268c0cd8e.tar.bz2 rails-7dc0f3fc8d3160db3408ef5a20c43a7268c0cd8e.zip |
Document the PartialIteration object
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 |