class EacRubyUtils::RecursiveBuilder

def check_next_item

def check_next_item
  return false unless to_check.any?
  item = to_check.shift
  added << item
  item_neighborhs(item).each { |sub_item| item_try_add_to_check(sub_item) }
  true
end

def initialize(root, &neighbors_block)

def initialize(root, &neighbors_block)
  @root = root
  @neighbors_block = neighbors_block
end

def item_added?(item)

def item_added?(item)
  added.include?(item) || to_check.include?(item)
end

def item_neighborhs(item)

def item_neighborhs(item)
  neighbors_block.call(item)
end

def item_try_add_to_check(item)

def item_try_add_to_check(item)
  to_check << item unless item_added?(item)
end

def result_uncached

def result_uncached
  @added = []
  @to_check = []
  item_try_add_to_check(root)
  while check_next_item
    # Do nothing
  end
  added
end