Module: Synctest::Patches::SizedQueuePatch

Defined in:
lib/synctest/patches.rb

Instance Method Summary collapse

Instance Method Details

#<<(object) ⇒ Object



504
505
506
507
508
509
# File 'lib/synctest/patches.rb', line 504

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

  bubble.sized_queue_push(self, object, false, nil)
end

#clearObject



518
519
520
521
522
523
# File 'lib/synctest/patches.rb', line 518

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

  bubble.queue_clear(self)
end

#closeObject



511
512
513
514
515
516
# File 'lib/synctest/patches.rb', line 511

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

  bubble.queue_close(self)
end

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



483
484
485
486
487
488
# File 'lib/synctest/patches.rb', line 483

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, non_block = false, timeout: nil) ⇒ Object



497
498
499
500
501
502
# File 'lib/synctest/patches.rb', line 497

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

  bubble.sized_queue_push(self, object, non_block, timeout)
end

#initializeObject



464
465
466
467
# File 'lib/synctest/patches.rb', line 464

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

#max=(maximum) ⇒ Object



525
526
527
528
529
530
531
532
# File 'lib/synctest/patches.rb', line 525

def max=(maximum)
  bubble = Synctest.bubble_for_operation(self)
  if bubble
    bubble.sized_queue_set_max(self, maximum)
  else
    super
  end
end

#num_waitingObject



534
535
536
537
538
539
# File 'lib/synctest/patches.rb', line 534

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



469
470
471
472
473
474
# File 'lib/synctest/patches.rb', line 469

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, non_block = false, timeout: nil) ⇒ Object



490
491
492
493
494
495
# File 'lib/synctest/patches.rb', line 490

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

  bubble.sized_queue_push(self, object, non_block, timeout)
end

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



476
477
478
479
480
481
# File 'lib/synctest/patches.rb', line 476

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