Sha256: a2ed753d8be962e68c6ffee2f82eef1773b1bf9cfff153f068b0ee0a973701f3

Contents?: true

Size: 770 Bytes

Versions: 114

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module SdrClient
  module Deposit
    # This strategy is for building one file set per set of similarly prefixed uploaded files
    class MatchingFileGroupingStrategy
      # @param [Array<SdrClient::Deposit::Files::DirectUploadResponse>] uploads the uploaded files to attach.
      # @return [Array<Array<SdrClient::Deposit::Files::DirectUploadResponse>>] uploads the grouped uploaded files.
      def self.run(uploads: [])
        # Call `#values` on the result of the grouping operation because 1)
        # `Process#build_filesets` expects an array of arrays, not an array of
        # hashes, and 2) the keys aren't used anywhere
        uploads.group_by { |ul| ::File.basename(ul.filename, '.*') }.values
      end
    end
  end
end

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
sdr-client-0.96.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.95.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.94.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.93.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.92.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.91.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.90.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.89.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.88.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.87.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.86.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.85.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.84.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.83.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.82.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.81.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.80.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.79.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.78.0 lib/sdr_client/deposit/matching_file_grouping_strategy.rb
sdr-client-0.77.1 lib/sdr_client/deposit/matching_file_grouping_strategy.rb