Sha256: c1535eebce3aeee8da6f2b57562d8942d31b9888709981cbfecb1dc263344174

Contents?: true

Size: 626 Bytes

Versions: 36

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Util
    class Performer
      attr_reader :operations

      def initialize(operations:)
        @operations = operations
      end

      def perform
        @perform ||= validate_all
                     .and_then { perform_all }
                     .and_then { Result.Success(self) }
      end

      private

      def perform_all
        operations.inject(Result.Success) { |res, op| res.and_then { op.perform } }
      end

      def validate_all
        operations.inject(Result.Success) { |res, op| res.and_then { op.validate } }
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ledger_sync-3.0.0 lib/ledger_sync/util/performer.rb
ledger_sync-2.6.0 lib/ledger_sync/util/performer.rb
ledger_sync-2.5.0 lib/ledger_sync/util/performer.rb
ledger_sync-2.4.4 lib/ledger_sync/util/performer.rb
ledger_sync-2.3.1 lib/ledger_sync/util/performer.rb
ledger_sync-2.2.3 lib/ledger_sync/util/performer.rb
ledger_sync-2.2.1 lib/ledger_sync/util/performer.rb
ledger_sync-2.2.0 lib/ledger_sync/util/performer.rb
ledger_sync-2.0.2 lib/ledger_sync/util/performer.rb
ledger_sync-2.0.1 lib/ledger_sync/util/performer.rb
ledger_sync-2.0.0 lib/ledger_sync/util/performer.rb
ledger_sync-2.0.0.pre.1 lib/ledger_sync/util/performer.rb
ledger_sync-1.8.1 lib/ledger_sync/util/performer.rb
ledger_sync-1.8.0 lib/ledger_sync/util/performer.rb
ledger_sync-1.7.0 lib/ledger_sync/util/performer.rb
ledger_sync-1.6.0 lib/ledger_sync/util/performer.rb
ledger_sync-1.5.2 lib/ledger_sync/util/performer.rb
ledger_sync-1.5.1 lib/ledger_sync/util/performer.rb
ledger_sync-1.5.0 lib/ledger_sync/util/performer.rb
ledger_sync-1.4.4 lib/ledger_sync/util/performer.rb