Module: Puma::QueueClose
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/puma/queue_close.rb |
Overview
Queue#close
was added in Ruby 2.3. Add a simple implementation for earlier Ruby versions.
Instance Attribute Summary
- #closed? ⇒ Boolean readonly
Instance Method Summary
-
#<<(object)
Alias for #push.
- #close
- #pop(non_block = false)
- #push(object) (also: #<<)
Instance Attribute Details
#closed? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/puma/queue_close.rb', line 12
def closed? @closed ||= false end
Instance Method Details
#<<(object)
Alias for #push.
# File 'lib/puma/queue_close.rb', line 19
alias << push
#close
[ GitHub ]# File 'lib/puma/queue_close.rb', line 8
def close num_waiting.times {push nil} @closed = true end
#pop(non_block = false)
[ GitHub ]# File 'lib/puma/queue_close.rb', line 20
def pop(non_block=false) return nil if !non_block && closed? && empty? super end
#push(object) Also known as: #<<
# File 'lib/puma/queue_close.rb', line 15
def push(object) raise ClosedQueueError if closed? super end