Class: VcrStripeWebhook::StripeCLI::ReadyWaiter
- Inherits:
-
Object
- Object
- VcrStripeWebhook::StripeCLI::ReadyWaiter
- Defined in:
- lib/vcr_stripe_webhook/stripe_cli.rb
Instance Method Summary collapse
-
#initialize ⇒ ReadyWaiter
constructor
A new instance of ReadyWaiter.
- #signal_ready ⇒ Object
- #wait_ready ⇒ Object
Constructor Details
#initialize ⇒ ReadyWaiter
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_ready ⇒ Object
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_ready ⇒ Object
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 |