planas/pbf_parser — pull request #1 by martinjos (2013-09-23 13:48:54+00:00)
Title: Random access & position tracking

I've added the following methods:

#seek(n)	Move to (and read) the nth OSMData block in the file
#size	Return the number of OSMData blocks in the file
#pos	Return the index of the current OSMData block in the file (0 = first block, 1 = second block, etc.)
#pos= n	Synonym for #seek(n)
#blobs	Return debugging information about the OSMData blobs (CAUTION: currently returns a mutable internal data structure)

The most notable C functions are:

seek_to_osm_data()	The implementation of #seek and #pos=.
find_all_blobs()	Called from initialize. Does a quick scan through the whole file finding the data blobs, and building up the @blobs array (which is used internally to implement #seek and #size).