For a very straight-forward example, you might like to have
a look at the html-parser library which is a line by line
translation of the similarly-named module bundled with the
python standard library.

<http://raa.ruby-lang.org/list.rhtml?name=html-parser-2>