move index_of to list

and give it a sort of basic implementation
This commit is contained in:
Torsten Ruger
2015-05-14 19:54:38 +03:00
parent c2b84925a4
commit 5e0e8c8364
2 changed files with 15 additions and 10 deletions

View File

@ -3,6 +3,18 @@
module Parfait
class List < Object
def index_of( item )
max = self.length
counter = 0
while( counter < max )
if( internal_object_get(index) == item)
return counter
end
counter = counter + 1
end
return nil
end
# push means add to the end
# this automatically grows the List
def push value