Skip to content

Commit b75aaac

Browse files
committed
simplify some refactoring artifacts
1 parent 8c296ca commit b75aaac

File tree

1 file changed

+4
-4
lines changed
  • lib/mongoid/association/embedded/embeds_many

1 file changed

+4
-4
lines changed

lib/mongoid/association/embedded/embeds_many/proxy.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ def id_of(doc)
452452
# Optimized version of #append that handles multiple documents
453453
# in a more efficient way.
454454
def append_many(documents, &block)
455-
visited_docs = Set.new(_target.map { |doc| id_of(doc) })
456-
unique_set = get_unique_new_docs(documents, visited_docs, &block)
455+
unique_set = get_unique_new_docs(documents, &block)
457456

458457
_unscoped.concat(unique_set)
459458
_target.push(*scope(unique_set))
@@ -463,8 +462,9 @@ def append_many(documents, &block)
463462
end
464463

465464
# Return a list of unique new documents that do not yet exist
466-
# in the association, and which have not previously been seen.
467-
def get_unique_new_docs(documents, visited_docs, &block)
465+
# in the association.
466+
def get_unique_new_docs(documents, &block)
467+
visited_docs = Set.new(_target.map { |doc| id_of(doc) })
468468
next_index = _unscoped.size
469469

470470
documents.select do |doc|

0 commit comments

Comments
 (0)