class Liquid::TablerowloopDrop
@liquid_public_docs @liquid_type object @liquid_name tablerowloop @liquid_summary
Information about a parent [`tablerow` loop](/docs/api/liquid/tags/tablerow).
Attributes
@liquid_public_docs @liquid_summary
The 1-based index of the current column.
@liquid_return [number]
@liquid_public_docs @liquid_summary
The total number of iterations in the loop.
@liquid_return [number]
@liquid_public_docs @liquid_summary
The 1-based index of current row.
@liquid_return [number]
Public Class Methods
Source
# File lib/liquid/tablerowloop_drop.rb, line 10 def initialize(length, cols) @length = length @row = 1 @col = 1 @cols = cols @index = 0 end
Public Instance Methods
Source
# File lib/liquid/tablerowloop_drop.rb, line 56 def col0 @col - 1 end
@liquid_public_docs @liquid_summary
The 0-based index of the current column.
@liquid_return [number]
Source
# File lib/liquid/tablerowloop_drop.rb, line 96 def col_first @col == 1 end
@liquid_public_docs @liquid_summary
Returns `true` if the current column is the first in the row. Returns `false` if not.
@liquid_return [boolean]
Source
# File lib/liquid/tablerowloop_drop.rb, line 104 def col_last @col == @cols end
@liquid_public_docs @liquid_summary
Returns `true` if the current column is the last in the row. Returns `false` if not.
@liquid_return [boolean]
Source
# File lib/liquid/tablerowloop_drop.rb, line 80 def first @index == 0 end
@liquid_public_docs @liquid_summary
Returns `true` if the current iteration is the first. Returns `false` if not.
@liquid_return [boolean]
Source
# File lib/liquid/tablerowloop_drop.rb, line 40 def index @index + 1 end
@liquid_public_docs @liquid_summary
The 1-based index of the current iteration.
@liquid_return [number]
Source
# File lib/liquid/tablerowloop_drop.rb, line 48 def index0 @index end
@liquid_public_docs @liquid_summary
The 0-based index of the current iteration.
@liquid_return [number]
Source
# File lib/liquid/tablerowloop_drop.rb, line 88 def last @index == @length - 1 end
@liquid_public_docs @liquid_summary
Returns `true` if the current iteration is the last. Returns `false` if not.
@liquid_return [boolean]
Source
# File lib/liquid/tablerowloop_drop.rb, line 64 def rindex @length - @index end
@liquid_public_docs @liquid_summary
The 1-based index of the current iteration, in reverse order.
@liquid_return [number]
Source
# File lib/liquid/tablerowloop_drop.rb, line 72 def rindex0 @length - @index - 1 end
@liquid_public_docs @liquid_summary
The 0-based index of the current iteration, in reverse order.
@liquid_return [number]
Protected Instance Methods
Source
# File lib/liquid/tablerowloop_drop.rb, line 110 def increment! @index += 1 if @col == @cols @col = 1 @row += 1 else @col += 1 end end