add each_with_index to indexed

This commit is contained in:
Torsten Ruger
2016-12-08 12:48:39 +02:00
parent ad91c0a4bf
commit 137d3c9231
2 changed files with 16 additions and 0 deletions

View File

@ -112,6 +112,16 @@ module Parfait
self
end
def each_with_index
index = 1
while index <= self.get_length
item = get(index)
yield item , index
index = index + 1
end
self
end
def each_pair
index = 1
while index <= self.get_length