Method: Kernel#loop_with_object
- Defined in:
- lib/mug/loop-with.rb
#loop_with_object(obj) ⇒ Object
Repeatedly executes the block, yielding an arbitrary object, obj.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mug/loop-with.rb', line 24 def loop_with_object(obj) return obj=enum_for(:loop_with_object, obj) unless block_given? begin while true yield obj end rescue StopIteration end obj end |