Class: Loop
- Inherits:
-
Object
- Object
- Loop
- Defined in:
- lib/skiplist/loop.rb
Overview
by Nobuyoshi Nakada [ruby-dev:41909]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.loop(&block) ⇒ Object
26 27 28 |
# File 'lib/skiplist/loop.rb', line 26 def self.loop &block new.loop(&block) end |
Instance Method Details
#break(val = nil) ⇒ Object
22 23 24 |
# File 'lib/skiplist/loop.rb', line 22 def break val=nil throw self, [false, val] end |
#loop ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/skiplist/loop.rb', line 8 def loop begin t, val = catch(self){ yield self true } end while t val end |
#next(val = nil) ⇒ Object
18 19 20 |
# File 'lib/skiplist/loop.rb', line 18 def next val=nil throw self, [true, val] end |