Sha256: 025782b5eed11d0029905c378db61d005f6b4f623696bd7f23ef7819e69a777f

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

module SampleDataDump
  module UseCases
    class ActorDumpsSampleDataToFiles
      def initialize(persistence)
        @persistence = persistence
      end

      def result
        @persistence.load_table_configurations.fmap do |table_configurations|
          result = process_table_configurations_list(table_configurations)
          return result if result.failure?
        end
      end

      private

      def process_table_configurations_list(table_configurations)
        results = table_configurations.map do |table_configuration|
          result = process_table_configuration(table_configuration)
          return result if result.failure?
        end
        results.last || Dry::Monads::Success(true)
      end

      def process_table_configuration(table_configuration)
        @persistence.valid?(table_configuration).bind do
          @persistence.dump_and_compress_data_to_local_file(table_configuration)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sample_data_dump-0.0.1 lib/sample_data_dump/use_cases/actor_dumps_sample_data_to_files.rb