Class: VcrStripeWebhook::StripeCLI::ReadyWaiter

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr_stripe_webhook/stripe_cli.rb

Instance Method Summary collapse

Constructor Details

#initializeReadyWaiter

Returns a new instance of ReadyWaiter.



73
74
75
76
77
# File 'lib/vcr_stripe_webhook/stripe_cli.rb', line 73

def initialize
  @ready = false
  @ready_mutex = Mutex.new
  @ready_cond_var = ConditionVariable.new
end

Instance Method Details

#signal_readyObject



89
90
91
92
93
94
# File 'lib/vcr_stripe_webhook/stripe_cli.rb', line 89

def signal_ready
  @ready_mutex.synchronize do
    @ready = true
    @ready_cond_var.signal
  end
end

#wait_readyObject



79
80
81
82
83
84
85
86
87
# File 'lib/vcr_stripe_webhook/stripe_cli.rb', line 79

def wait_ready
  @ready_mutex.synchronize do
    loop do
      break if @ready

      @ready_cond_var.wait(@ready_mutex)
    end
  end
end