Method: Thread::Channel#receive!
- Defined in:
- lib/thread/channel.rb
#receive!(&block) ⇒ Object
Receive a message, if there are none the call returns nil.
If a block is passed, it’s used as guard to match to a message.
86 87 88 89 90 91 92 |
# File 'lib/thread/channel.rb', line 86 def receive!(&block) if block .delete_at(.find_index(&block)) else .shift end end |