fix code duplication

This commit is contained in:
Torsten Ruger
2015-10-16 19:18:37 +03:00
parent 5131e5d050
commit 3e79e5cf8e
3 changed files with 6 additions and 13 deletions

View File

@ -73,7 +73,7 @@ module Parfait
return nil if empty?
get(get_length())
end
# set the value at index.
# Lists start from index 1
def set( index , value)
@ -164,8 +164,11 @@ module Parfait
end
def inspect
inspect_from 1
end
def inspect_from index
ret = ""
index = 1
while index <= self.get_length
item = get(index)
ret += item.inspect