nLight/css-class-string — pull request #1 by temochka (2014-06-10 23:02:49+00:00)
Title: Improved performance and unit tests coverage

Great idea Dmitry! Often missed something like this in Rails. The implementation looks a bit overcomplicated to me though. I refactored the `#to_s` method, made it shorter and approximately 1.3x times faster (benchmark included). This change is practical since the method can be frequently called during the rendering stage, therefore the faster it is, the better.

The performance can be improved even further by replacing `#map` with `#reduce([])` thereby removing a need in `#compact`, and for the best possible results `#map` and `#join` should be replaced with a loop. Although I feel satisfied with the achieved balance of performance/simplicity and consider using this gem at work.

Thanks!