ActionView::PartialIteration

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 11
def initialize(size)
  @size  = size
  @index = 0
end

Public Instance Methods

first?() Show source

Check if this is the first iteration of the partial.

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

Check if this is the last iteration of the partial.

# File actionview/lib/action_view/renderer/partial_renderer.rb, line 22
def last?
  index == size - 1
end

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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部