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.
3
4
5
6
7
8
|
# File 'lib/liquid/forloop_drop.rb', line 3
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.
10
11
12
|
# File 'lib/liquid/forloop_drop.rb', line 10
def length
@length
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/liquid/forloop_drop.rb', line 10
def name
@name
end
|
#parentloop ⇒ Object
Returns the value of attribute parentloop.
10
11
12
|
# File 'lib/liquid/forloop_drop.rb', line 10
def parentloop
@parentloop
end
|
Instance Method Details
#first ⇒ Object
28
29
30
|
# File 'lib/liquid/forloop_drop.rb', line 28
def first
@index == 0
end
|
#index ⇒ Object
12
13
14
|
# File 'lib/liquid/forloop_drop.rb', line 12
def index
@index + 1
end
|
#index0 ⇒ Object
16
17
18
|
# File 'lib/liquid/forloop_drop.rb', line 16
def index0
@index
end
|
#last ⇒ Object
32
33
34
|
# File 'lib/liquid/forloop_drop.rb', line 32
def last
@index == @length - 1
end
|
#rindex ⇒ Object
20
21
22
|
# File 'lib/liquid/forloop_drop.rb', line 20
def rindex
@length - @index
end
|
#rindex0 ⇒ Object
24
25
26
|
# File 'lib/liquid/forloop_drop.rb', line 24
def rindex0
@length - @index - 1
end
|