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.


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

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


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

def col
  @col
end

#lengthObject (readonly)

Returns the value of attribute length


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

def length
  @length
end

#rowObject (readonly)

Returns the value of attribute row


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

def row
  @row
end

Instance Method Details

#col0Object


23
24
25
# File 'lib/liquid/tablerowloop_drop.rb', line 23

def col0
  @col - 1
end

#col_firstObject


43
44
45
# File 'lib/liquid/tablerowloop_drop.rb', line 43

def col_first
  @col == 1
end

#col_lastObject


47
48
49
# File 'lib/liquid/tablerowloop_drop.rb', line 47

def col_last
  @col == @cols
end

#firstObject


35
36
37
# File 'lib/liquid/tablerowloop_drop.rb', line 35

def first
  @index == 0
end

#indexObject


15
16
17
# File 'lib/liquid/tablerowloop_drop.rb', line 15

def index
  @index + 1
end

#index0Object


19
20
21
# File 'lib/liquid/tablerowloop_drop.rb', line 19

def index0
  @index
end

#lastObject


39
40
41
# File 'lib/liquid/tablerowloop_drop.rb', line 39

def last
  @index == @length - 1
end

#rindexObject


27
28
29
# File 'lib/liquid/tablerowloop_drop.rb', line 27

def rindex
  @length - @index
end

#rindex0Object


31
32
33
# File 'lib/liquid/tablerowloop_drop.rb', line 31

def rindex0
  @length - @index - 1
end