holman/shamazing — pull request #7 by joeyw (2012-05-02 00:06:29+00:00)
Title: Refactored algorithm. Clarified documentation.

There was no need for sorting the strings into a specific
order when we just want the longest one. Out of several
methods of determining the longest string, max_by was
chosen; it was the second fastest, chosen because the faster
alternative required extending the Array class with more code.

Refactored the string downcasing to only downcase the longest
string, saving a few cycles since it does not have to transform
the entire sha. This change required modifying the regex that
detected the strings to ignore character case.

These changes provided a slight performance boost and, i think,
slightly more readible code that does what the documentation says
it does.

Benchmark data and code: [https://gist.github.com/2572524](https://gist.github.com/2572524)