Sha256: 71fa5c6ea62f4b4b6a9b4d0d0c410060a79a9a5df08cdfb75214d9c497d3f6fe

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module LightServiceExt
  class ApplicationOrganizer
    extend LightService::Organizer

    class << self
      def call(context)
        with(ApplicationContext.make_with_defaults(context))
          .around_each(RecordActions)
          .reduce(all_steps)
      end

      def steps
        raise NotImplementedError
      end

      def reduce_if_success(steps)
        reduce_if(->(ctx) { ctx.success? && ctx[:errors].blank? }, steps)
      end

      private

      def all_steps
        return steps.push(AllActionsCompleteAction) if steps.is_a?(Array)

        [steps].push(AllActionsCompleteAction)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
light-service-ext-0.1.8 lib/light-service-ext/application_organizer.rb
light-service-ext-0.1.7 lib/light-service-ext/application_organizer.rb
light-service-ext-0.1.6 lib/light-service-ext/application_organizer.rb
light-service-ext-0.1.5 lib/light-service-ext/application_organizer.rb
light-service-ext-0.1.4 lib/light-service-ext/application_organizer.rb
light-service-ext-0.1.3 lib/light-service-ext/application_organizer.rb