Class: Liquid::TablerowloopDrop

Inherits:
Drop
  • Object
show all
Defined in:
lib/liquid/tablerowloop_drop.rb

Instance Attribute Summary collapse

Attributes inherited from Drop

#context

Instance Method Summary collapse

Methods inherited from Drop

#inspect, invokable?, invokable_methods, #invoke_drop, #key?, #liquid_method_missing, #to_liquid, #to_s

Constructor Details

#initialize(length, cols) ⇒ TablerowloopDrop

Returns a new instance of TablerowloopDrop



3
4
5
6
7
8
9
# File 'lib/liquid/tablerowloop_drop.rb', line 3

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

Instance Attribute Details

#colObject (readonly)

Returns the value of attribute col



11
12
13
# File 'lib/liquid/tablerowloop_drop.rb', line 11

def col
  @col
end

#lengthObject (readonly)

Returns the value of attribute length



11
12
13
# File 'lib/liquid/tablerowloop_drop.rb', line 11

def length
  @length
end

#rowObject (readonly)

Returns the value of attribute row



11
12
13
# File 'lib/liquid/tablerowloop_drop.rb', line 11

def row
  @row
end

Instance Method Details

#col0Object



21
22
23
# File 'lib/liquid/tablerowloop_drop.rb', line 21

def col0
  @col - 1
end

#col_firstObject



41
42
43
# File 'lib/liquid/tablerowloop_drop.rb', line 41

def col_first
  @col == 1
end

#col_lastObject



45
46
47
# File 'lib/liquid/tablerowloop_drop.rb', line 45

def col_last
  @col == @cols
end

#firstObject



33
34
35
# File 'lib/liquid/tablerowloop_drop.rb', line 33

def first
  @index == 0
end

#indexObject



13
14
15
# File 'lib/liquid/tablerowloop_drop.rb', line 13

def index
  @index + 1
end

#index0Object



17
18
19
# File 'lib/liquid/tablerowloop_drop.rb', line 17

def index0
  @index
end

#lastObject



37
38
39
# File 'lib/liquid/tablerowloop_drop.rb', line 37

def last
  @index == @length - 1
end

#rindexObject



25
26
27
# File 'lib/liquid/tablerowloop_drop.rb', line 25

def rindex
  @length - @index
end

#rindex0Object



29
30
31
# File 'lib/liquid/tablerowloop_drop.rb', line 29

def rindex0
  @length - @index - 1
end