module Eco module API class MicroCases # Detects who has left the organization and `yield` s them one by one to the given block # @note to be used only when the input file is the full DB # @param entries [Eco::API::Common::People::Entries] the input entries with the data. # @param people [Eco::API::Organization::People] target existing _People_ of the current update. # @param options [Hash] the options. # @yield [person] gives each person of `people` that is not present in `entries`. # @yieldparam person [Ecoportal::API::V1::Person] the person that leaves the org. # @return [Eco::API::Organization::People] the leavers. def with_each_leaver(entries, people, options) leavers = people.map do |person| unless entries.find(person, strict: micro.strict_search?(options)) yield(person) if block_given? person end end.compact people.newFrom leavers end end end end