Method: Sequence#holding
- Defined in:
- lib/sequence.rb
#holding ⇒ Object
hold current position while executing a block. The block is passed the current sequence as its parameter. you can move the position around or call methods like read that do it, but after the block returns, the position is reset to the original location. The return value is the result of the block.
259 260 261 262 263 264 265 266 |
# File 'lib/sequence.rb', line 259 def holding oldpos=pos begin yield self ensure self.pos=oldpos end end |