Sha256: 7a2d020b28f7538350bc61d93ad42608609c7c609895c4dceb401261525f2189

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'pp'

module Clomp
  class Executor
    class << self
      # _self = operation
      #
      def [](result = {}, options, _self:)
        result['tracks'].each do |track|
          next if _self.successful? && track.left_track?
          next if _self.failed? && track.right_track?
          
          _callable_object = Callable[track, options, _self]
          
          raise Errors::TrackNotDefined, "Please define the track in your operation/service: #{track.name} in #{_callable_object.class}" unless _callable_object.respond_to?(track.name)
          
          _track = track.exec!(_callable_object, options)
          
          _self.executed << _track
          
          _track.executed = true
          
          # Considering pass first on success state
          break if _track.success? && (_track.track_options[:pass_fast])
          
          # Consider both local or global configuration
          break if _track.failure? && (_track.track_options[:fail_fast])
        end
        
        _self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clomp-0.0.8 lib/clomp/executor.rb