Class: Liquid::ForloopDrop
- Inherits:
-
Drop
- Object
- Drop
- Liquid::ForloopDrop
show all
- Defined in:
- lib/liquid/forloop_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(name, length, parentloop) ⇒ ForloopDrop
Returns a new instance of ForloopDrop.
5
6
7
8
9
10
|
# File 'lib/liquid/forloop_drop.rb', line 5
def initialize(name, length, parentloop)
@name = name
@length = length
@parentloop = parentloop
@index = 0
end
|
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
12
13
14
|
# File 'lib/liquid/forloop_drop.rb', line 12
def length
@length
end
|
#parentloop ⇒ Object
Returns the value of attribute parentloop.
12
13
14
|
# File 'lib/liquid/forloop_drop.rb', line 12
def parentloop
@parentloop
end
|
Instance Method Details
#first ⇒ Object
35
36
37
|
# File 'lib/liquid/forloop_drop.rb', line 35
def first
@index == 0
end
|
#index ⇒ Object
19
20
21
|
# File 'lib/liquid/forloop_drop.rb', line 19
def index
@index + 1
end
|
#index0 ⇒ Object
23
24
25
|
# File 'lib/liquid/forloop_drop.rb', line 23
def index0
@index
end
|
#last ⇒ Object
39
40
41
|
# File 'lib/liquid/forloop_drop.rb', line 39
def last
@index == @length - 1
end
|
#name ⇒ Object
14
15
16
17
|
# File 'lib/liquid/forloop_drop.rb', line 14
def name
Usage.increment('forloop_drop_name')
@name
end
|
#rindex ⇒ Object
27
28
29
|
# File 'lib/liquid/forloop_drop.rb', line 27
def rindex
@length - @index
end
|
#rindex0 ⇒ Object
31
32
33
|
# File 'lib/liquid/forloop_drop.rb', line 31
def rindex0
@length - @index - 1
end
|