Method: Transformer::Lazy#take_while
- Defined in:
- lib/coroutines/base.rb
#take_while(&block) ⇒ Object
443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/coroutines/base.rb', line 443 def take_while(&block) Transformer.new do |y| yy = Yielder.new y yy.define_yield do |*values| if block.call(*values) y.yield(*values) else raise StopIteration end yy end @trans.call yy end end |