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:
parent
9290fc5ce2
commit
7dc0f3fc8d
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue