Sha256: 98c1faf0a860883e4ab3bd3e16dcf55139ff65eaff197630bbb5a2cc0b927a23

Contents?: true

Size: 1.01 KB

Versions: 98

Compression:

Stored size: 1.01 KB

Contents

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

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
eco-helpers-2.0.46 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.45 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.44 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.43 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.42 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.41 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.40 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.39 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.38 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.37 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.36 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.35 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.34 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.33 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.32 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.31 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.30 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.29 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.28 lib/eco/api/microcases/with_each_leaver.rb
eco-helpers-2.0.27 lib/eco/api/microcases/with_each_leaver.rb