class ActiveFedora::Aggregation::OrderedReader

Lazily iterates over a doubly linked list, fixing up nodes if necessary.

Attributes

root[R]

Public Class Methods

new(root) click to toggle source
# File lib/active_fedora/aggregation/ordered_reader.rb, line 7
def initialize(root)
  @root = root
end

Public Instance Methods

each() { |proxy| ... } click to toggle source
# File lib/active_fedora/aggregation/ordered_reader.rb, line 11
def each
  proxy = first_head
  while proxy
    yield proxy unless proxy.nil?
    next_proxy = proxy.next
    next_proxy.try(:prev=, proxy) if next_proxy && next_proxy.prev != proxy
    proxy = next_proxy
  end
end

Private Instance Methods

first_head() click to toggle source
# File lib/active_fedora/aggregation/ordered_reader.rb, line 23
def first_head
  root.head
end