1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Document the PartialIteration object

This commit is contained in:
Rafael Mendonça França 2014-07-16 14:38:07 -03:00
parent 9290fc5ce2
commit 7dc0f3fc8d

View file

@ -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