Class: Solid::LiquidExtensions::ForLoop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Solid::LiquidExtensions::ForLoop
- Defined in:
- lib/solid/liquid_extensions/for_tag.rb
Direct Known Subclasses
Instance Method Summary collapse
- #first ⇒ Object
- #inc! ⇒ Object
- #index ⇒ Object
- #index0 ⇒ Object
-
#initialize(collection) ⇒ ForLoop
constructor
A new instance of ForLoop.
- #last ⇒ Object
- #length ⇒ Object
- #rindex ⇒ Object
- #rindex0 ⇒ Object
Constructor Details
#initialize(collection) ⇒ ForLoop
Returns a new instance of ForLoop.
52 53 54 55 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 52 def initialize(collection) @collection = collection @index0 = 0 end |
Instance Method Details
#first ⇒ Object
77 78 79 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 77 def first index0 == 0 end |
#inc! ⇒ Object
85 86 87 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 85 def inc! @index0 += 1 end |
#index ⇒ Object
61 62 63 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 61 def index index0 + 1 end |
#index0 ⇒ Object
57 58 59 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 57 def index0 @index0 end |
#last ⇒ Object
81 82 83 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 81 def last index == length end |
#length ⇒ Object
73 74 75 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 73 def length @collection.length end |
#rindex ⇒ Object
65 66 67 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 65 def rindex length - index0 end |
#rindex0 ⇒ Object
69 70 71 |
# File 'lib/solid/liquid_extensions/for_tag.rb', line 69 def rindex0 length - index0 - 1 end |