Sha256: 27604090d498b02a406edf2507c1f9dcce64871a0489340d15d41fa7cdf7bb78

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

# typed: true
# frozen_string_literal: true

require 'duckface'
require 'clean_architecture/interfaces/success_payload'
require 'clean_architecture/serializers/success_payload'

module CleanArchitecture
  module Serializers
    class SuccessCollectionPayload
      implements_interface CleanArchitecture::Interfaces::SuccessPayload

      def initialize(collection, use_case_target_class)
        @collection = collection
        @use_case_target_class = use_case_target_class
      end

      def data
        @collection.map do |object|
          SuccessPayload.new(@use_case_target_class.new(object)).data
        end
      end

      def version
        '1.0'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clean-architecture-3.0.2 lib/clean_architecture/serializers/success_collection_payload.rb
clean-architecture-3.0.1 lib/clean_architecture/serializers/success_collection_payload.rb
clean-architecture-3.0.0 lib/clean_architecture/serializers/success_collection_payload.rb