方法
Attributes
| [R] | 索引 | 模板的当前迭代。 |
| [R] | size | 模板将进行的迭代次数。 |
类公共方法
new(size) 链接
源码: 显示 | 在 GitHub 上
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 13 def initialize(size) @size = size @index = 0 end
实例公共方法
first?() 链接
检查这是否是模板的第一次迭代。
源码: 显示 | 在 GitHub 上
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 19 def first? index == 0 end
last?() 链接
检查这是否是模板的最后一次迭代。
源码: 显示 | 在 GitHub 上
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 24 def last? index == size - 1 end