lib/clomp/track.rb in clomp-0.0.6 vs lib/clomp/track.rb in clomp-0.0.7

- old
+ new

@@ -1,10 +1,10 @@ module Clomp class Track include Clomp::CommonStates - attr_reader :name, :block, :track_options, :state, :error, :track_from + attr_reader :name, :block, :track_options, :state, :error, :track_from, :type VALID_TRACK_TYPES = %I(track failed_track finally catch) def initialize(name: (raise Errors::NoTrackProvided), track_options: {}, track_type: VALID_TRACK_TYPES.first, track_from: nil, &block) raise UnknownTrackType, 'Please provide a valid track type' unless VALID_TRACK_TYPES.include?(track_type) @@ -26,14 +26,10 @@ define_method "#{track_type}?" do @type == track_type end end - def track? - @type == :track - end - # Track#exec! executes the steps defined in the operation class def exec!(object, options) mark_as_failure! # going to execute! set to failure initially if object.method(name.to_sym).arity > 1 @@ -46,9 +42,11 @@ self rescue => e @error = e.message + + mark_as_failure! self end end end \ No newline at end of file