Class: Metasploit::Aggregator::EnumeratorQueue
- Inherits:
-
Object
- Object
- Metasploit::Aggregator::EnumeratorQueue
- Extended by:
- Forwardable
- Defined in:
- lib/metasploit/aggregator.rb
Overview
A EnumeratorQueue wraps a Queue to yield the items added to it.
Instance Method Summary collapse
- #each_item ⇒ Object
-
#initialize(sentinel) ⇒ EnumeratorQueue
constructor
A new instance of EnumeratorQueue.
Constructor Details
permalink #initialize(sentinel) ⇒ EnumeratorQueue
Returns a new instance of EnumeratorQueue.
265 266 267 268 |
# File 'lib/metasploit/aggregator.rb', line 265 def initialize(sentinel) @q = Queue.new @sentinel = sentinel end |
Instance Method Details
permalink #each_item ⇒ Object
[View source]
270 271 272 273 274 275 276 277 278 |
# File 'lib/metasploit/aggregator.rb', line 270 def each_item return enum_for(:each_item) unless block_given? loop do r = @q.pop break if r.equal?(@sentinel) fail r if r.is_a? Exception yield r end end |