class Liquid::TablerowloopDrop

Information about a parent [‘tablerow` loop](/docs/api/liquid/tags/tablerow).
@liquid_summary
@liquid_name tablerowloop
@liquid_type object
@liquid_public_docs

def col0

@liquid_return [number]
The 0-based index of the current column.
@liquid_summary
@liquid_public_docs
def col0
  @col - 1
end

def col_first

@liquid_return [boolean]
Returns `true` if the current column is the first in the row. Returns `false` if not.
@liquid_summary
@liquid_public_docs
def col_first
  @col == 1
end

def col_last

@liquid_return [boolean]
Returns `true` if the current column is the last in the row. Returns `false` if not.
@liquid_summary
@liquid_public_docs
def col_last
  @col == @cols
end

def first

@liquid_return [boolean]
Returns `true` if the current iteration is the first. Returns `false` if not.
@liquid_summary
@liquid_public_docs
def first
  @index == 0
end

def increment!

def increment!
  @index += 1
  if @col == @cols
    @col = 1
    @row += 1
  else
    @col += 1
  end
end

def index

@liquid_return [number]
The 1-based index of the current iteration.
@liquid_summary
@liquid_public_docs
def index
  @index + 1
end

def index0

@liquid_return [number]
The 0-based index of the current iteration.
@liquid_summary
@liquid_public_docs
def index0
  @index
end

def initialize(length, cols)

def initialize(length, cols)
  @length = length
  @row    = 1
  @col    = 1
  @cols   = cols
  @index  = 0
end

def last

@liquid_return [boolean]
Returns `true` if the current iteration is the last. Returns `false` if not.
@liquid_summary
@liquid_public_docs
def last
  @index == @length - 1
end

def rindex

@liquid_return [number]
The 1-based index of the current iteration, in reverse order.
@liquid_summary
@liquid_public_docs
def rindex
  @length - @index
end

def rindex0

@liquid_return [number]
The 0-based index of the current iteration, in reverse order.
@liquid_summary
@liquid_public_docs
def rindex0
  @length - @index - 1
end