Module: Synctest::Patches::QueuePatch

Defined in:
lib/synctest/patches.rb

Instance Method Summary collapse

Instance Method Details

#<<(object) ⇒ Object



434
435
436
437
438
439
# File 'lib/synctest/patches.rb', line 434

def <<(object)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_push(self, object)
end

#clearObject



448
449
450
451
452
453
# File 'lib/synctest/patches.rb', line 448

def clear
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_clear(self)
end

#closeObject



441
442
443
444
445
446
# File 'lib/synctest/patches.rb', line 441

def close
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_close(self)
end

#deq(non_block = false, timeout: nil) ⇒ Object



413
414
415
416
417
418
# File 'lib/synctest/patches.rb', line 413

def deq(non_block = false, timeout: nil)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_pop(self, non_block, timeout)
end

#enq(object) ⇒ Object



427
428
429
430
431
432
# File 'lib/synctest/patches.rb', line 427

def enq(object)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_push(self, object)
end

#initializeObject



394
395
396
397
# File 'lib/synctest/patches.rb', line 394

def initialize(...)
  super
  Synctest.associate(self)
end

#num_waitingObject



455
456
457
458
459
460
# File 'lib/synctest/patches.rb', line 455

def num_waiting
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_num_waiting(self, super)
end

#pop(non_block = false, timeout: nil) ⇒ Object



399
400
401
402
403
404
# File 'lib/synctest/patches.rb', line 399

def pop(non_block = false, timeout: nil)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_pop(self, non_block, timeout)
end

#push(object) ⇒ Object



420
421
422
423
424
425
# File 'lib/synctest/patches.rb', line 420

def push(object)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_push(self, object)
end

#shift(non_block = false, timeout: nil) ⇒ Object



406
407
408
409
410
411
# File 'lib/synctest/patches.rb', line 406

def shift(non_block = false, timeout: nil)
  bubble = Synctest.bubble_for_operation(self)
  return super unless bubble

  bubble.queue_pop(self, non_block, timeout)
end