Class: MoveToGo::Organizations::DuplicateSetArray

Inherits:
Array
  • Object
show all
Defined in:
lib/move-to-go/model/organizations.rb

Instance Method Summary collapse

Constructor Details

#initialize(rootmodel, array) ⇒ DuplicateSetArray

Returns a new instance of DuplicateSetArray.



24
25
26
27
# File 'lib/move-to-go/model/organizations.rb', line 24

def initialize(rootmodel, array)
    @rootmodel = rootmodel
    super(array)
end

Instance Method Details

#map_duplicates(&block) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/move-to-go/model/organizations.rb', line 29

def map_duplicates(&block)

    # Send the sets to the function that will decide to keep or remove them
    # Can return Nil, a single org, empty array or an array of orgs. Compact and flatten to fix
    self
        .map{ |duplicate_set| yield DuplicateSet.new duplicate_set}
        .flatten
        .compact
end