rails / 5.1.6 / actionview / partialiteration.html /

class ActionView::PartialIteration

Parent:
Object

Attributes

index [R]

The current iteration of the partial.

size [R]

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

Public Class Methods

new (size) Show source
# File actionview/lib/action_view/renderer/partial_renderer.rb, line 12
def initialize(size)
  @size  = size
  @index = 0
end

Public Instance Methods

first? () Show source
# File actionview/lib/action_view/renderer/partial_renderer.rb, line 18
def first?
  index == 0
end

Check if this is the first iteration of the partial.

last? () Show source
# File actionview/lib/action_view/renderer/partial_renderer.rb, line 23
def last?
  index == size - 1
end

Check if this is the last iteration of the partial.

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.