Sha256: fe37217850bc6a611ee9b663c70315aa3de197a8ebb270a57342460ee23bd88e

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result
  module Transitions
    require_relative 'transitions/listener'
    require_relative 'transitions/listeners'
    require_relative 'transitions/config'
    require_relative 'transitions/tree'
    require_relative 'transitions/tracking'

    THREAD_VAR_NAME = :bcdd_result_transitions_tracking

    EnsureResult = ->(result) do
      return result if result.is_a?(::BCDD::Result)

      raise Error::UnexpectedOutcome.build(outcome: result, origin: :transitions)
    end

    def self.tracking
      Thread.current[THREAD_VAR_NAME] ||= Tracking.instance
    end
  end

  def self.transitions(name: nil, desc: nil, &block)
    Transitions.tracking.exec(name, desc, &block)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-result-0.13.0 lib/bcdd/result/transitions.rb