ruby: iterate in LinkedList

develop
jj 2012-04-20 20:43:18 +02:00
parent 417356c3cb
commit 826e0b7dcf
1 changed files with 9 additions and 0 deletions

@ -508,6 +508,15 @@ class DfLinkedList < Compound
_at(addr)
end
include Enumerable
def each
o = self
while o
yield o.item if o.item
o = o.next
end
end
def inspect ; "#<DfLinkedList prev=#{'0x%X' % _prev} next=#{'0x%X' % _next} #{item.inspect}>" ; end
end