Class: Clomp::Executor
- Inherits:
-
Object
- Object
- Clomp::Executor
- Defined in:
- lib/clomp/executor.rb
Class Method Summary collapse
-
.[](result = {}, options, _self:) ⇒ Object
_self = operation.
- .break?(tracks, index) ⇒ Boolean
Class Method Details
.[](result = {}, options, _self:) ⇒ Object
_self = operation
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/clomp/executor.rb', line 9 def [](result = {}, , _self:) result['tracks'].each_with_index do |track, i| break if break?(result['tracks'], i) next if _self.successful? && track.left_track? next if _self.failed? && track.right_track? _callable_object = Callable[track, , _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, ) end _self end |
.break?(tracks, index) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/clomp/executor.rb', line 27 def break?(tracks, index) track = index > 0 && tracks[index -1] || Track.new(name: SecureRandom.hex(5)).tap {|track| track.mark_as_success! && track.executed = true } if track.right_track? && track.failure? return true if track.[:fail_fast] elsif track.left_track? return true if track.[:fail_fast] end true if track.[:pass_fast] end |