Skip to Content Skip to Search

class ActionView::PartialIteration

Attributes

[R] index

The current iteration of the partial.

[R] size

The number of iterations that will be done by the partial.

Public class methods

Source code GitHub
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 13
def initialize(size)
  @size  = size
  @index = 0
end

Public instance methods

Check if this is the first iteration of the partial.

Source code GitHub
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 19
def first?
  index == 0
end

Check if this is the last iteration of the partial.

Source code GitHub
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 24
def last?
  index == size - 1
end

Definition files