dparis/pismo — pull request #1 by cheald (2012-04-07 21:27:59+00:00)
Title: Many fixes, refactorings, and improvements

First off, if this is too big of a monster commit, no worries; I'm writing this for myself, but wanted to offer the pull back to head if you're interested.

I'm working to refactor a lot of the "ugly" pieces, to DRY up the code, reduce garbage generation, and rewrite to use idiomatic Ruby where possible. Longer term-goals are improvement of the extraction algorithms (particularly re: keywords) and making the whole shebang faster. HTML entity decoding and substitution is fully centralized and comprehensive. I've refactored the `foos(all = false)` and `foo` methods to just `foo` and `foos`; `foos` always memoizes the full set of matches, and the singular form is now a convenience method. This is potentially a backwards-incompatible change, but is a) much faster (since everything is cached now), and b) is a lot less surprising, IMO.

As a bonus, all tests now pass (head has 1 failing test), and the image test network calls are stubbed, meaning that the test suite in general runs much faster.