unnali/rouge — pull request #30 by noprompt (2012-12-29 01:09:24+00:00)
Title: Rouge types handle their string representation, refactor Rouge::Printer

Rouge types distinguish between `#to_s` and `#inspect`. We use `#to_s` for printing and display purposes, while `#inspect` is reserved for debugging.

The `Rouge::Printer` has been refactored as followed:

- `#to_s` is called on any `Numeric` type
- `Array`, `Hash`, `Set`, use a new method `print_collection` to print their elements
- Rouge types are printed with `#to_s` since they handle their own string representation
- Special treatment of keywords

The printing of keywords (Ruby symbols) is given special treatment in the case it contains white space. This gives us the best of both the Ruby and Lisp worlds in which a keyword such as :first-name prints as ":first-name" and the ruby symbol :"first name" prints as it would normally.

Note, I've done a little reorganization and made a few cosmetic tweaks in some places (I try to heed the boy scout rule). I'll leave some notes/questions in the diff.