Sha256: a1248a3a5dc2c1a45bb41a2acb90a7f9e32321f64834b5f214f4ac59acc08bb8

Contents?: true

Size: 345 Bytes

Versions: 58

Compression:

Stored size: 345 Bytes

Contents

class IO
  # saves the position and returns to it after the block
  # is executed. Returns the block's reply.  if rewind, io.rewind is called
  # before handing the io object to the block.
  def bookmark(rewind=false, &block)
    start = self.pos
    self.rewind if rewind
    reply = block.call(self) 
    self.pos = start
    reply
  end
end

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
mspire-0.10.8.0 lib/io/bookmark.rb
mspire-0.10.7.3 lib/io/bookmark.rb
mspire-0.10.7.2 lib/io/bookmark.rb
mspire-0.10.7.1 lib/io/bookmark.rb
mspire-0.10.7 lib/io/bookmark.rb
mspire-0.10.6 lib/io/bookmark.rb
mspire-0.10.5 lib/io/bookmark.rb
mspire-0.10.4 lib/io/bookmark.rb
mspire-0.10.3 lib/io/bookmark.rb
mspire-0.10.2 lib/io/bookmark.rb
mspire-0.10.1 lib/io/bookmark.rb
mspire-0.10.0 lib/io/bookmark.rb
mspire-0.9.2 lib/io/bookmark.rb
mspire-0.9.1 lib/io/bookmark.rb
mspire-0.9.0 lib/io/bookmark.rb
mspire-0.8.7 lib/io/bookmark.rb
mspire-0.8.6.2 lib/io/bookmark.rb
mspire-0.8.6.1 lib/io/bookmark.rb
mspire-0.8.6 lib/io/bookmark.rb
mspire-0.8.5 lib/io/bookmark.rb