dkubb/ice_nine — pull request #11 by misfo (2013-09-20 03:42:46+00:00)
Title: Freeze shallowly frozen objects and offer a faster option

* `deep_freeze` is 50% slower than before the commit, but will deep freeze shallowly frozen objects (fixing #10).
* `fast_deep_freeze` is 2.5x faster than previous deep_freeze, with the exact same behavior.

This PR incorporates the faster algorithm from #9, but with the method name `IceNine.fast_deep_freeze`.

If someone has a better idea for the method names, let me know. My reasoning was that `deep_freeze` will never have any surprising edge cases (like #10) and `fast_deep_freeze` is an acceptable name for the other method because it screams "I know what I'm doing here!" The downside of this name is that literals are good candidates for `fast_deep_freeze`, and I don't look forward to seeing:

```ruby
AN_ARRAY = IceNine.fast_deep_freeze %w(a b c)
A_HASH = IceNine.fast_deep_freeze({:a => 1, :b => 2})
```

The `fast_` just adds that much more noise to the code...

I still need to update the tests and documentation a bit, I just thought I'd see what people think...