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.
10
11
12
13
14
15
|
# File 'lib/liquid/forloop_drop.rb', line 10
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.
22
23
24
|
# File 'lib/liquid/forloop_drop.rb', line 22
def length
@length
end
|
#parentloop ⇒ Object
Returns the value of attribute parentloop.
31
32
33
|
# File 'lib/liquid/forloop_drop.rb', line 31
def parentloop
@parentloop
end
|
Instance Method Details
#first ⇒ Object
74
75
76
|
# File 'lib/liquid/forloop_drop.rb', line 74
def first
@index == 0
end
|
#index ⇒ Object
42
43
44
|
# File 'lib/liquid/forloop_drop.rb', line 42
def index
@index + 1
end
|
#index0 ⇒ Object
50
51
52
|
# File 'lib/liquid/forloop_drop.rb', line 50
def index0
@index
end
|
#last ⇒ Object
82
83
84
|
# File 'lib/liquid/forloop_drop.rb', line 82
def last
@index == @length - 1
end
|
#name ⇒ Object
33
34
35
36
|
# File 'lib/liquid/forloop_drop.rb', line 33
def name
Usage.increment('forloop_drop_name')
@name
end
|
#rindex ⇒ Object
58
59
60
|
# File 'lib/liquid/forloop_drop.rb', line 58
def rindex
@length - @index
end
|
#rindex0 ⇒ Object
66
67
68
|
# File 'lib/liquid/forloop_drop.rb', line 66
def rindex0
@length - @index - 1
end
|