markbates/configatron — pull request #64 by gdb (2014-05-26 01:50:00+00:00)
Title: Clean up interface

- Lock an entire configatron instance rather than each node. This
seems to be semantically what you always want.

- Track parent pointers, and add a nice to_s method to configatron
(and throw NoMethodError upon to_ary). In addition to making `puts`
work, it makes it way easier to figure out where a UndefinedKeyError
is coming from.

- Decide if a key is present by checking `@attributes.include?(key)`,
rather than `@attributes[key].nil?`. The latter was pretty
misleading, since running `configatron.foo.bar` would mean
`configatron.foo` would be counted as having `bar` unset, though
`configatron` would have `foo` set. (I.e. it wasn't doing a deep nil
check.)

- Get rid of nil? / empty? methods. Both of them are at best
misleading: if you check `configatron.foo.nil?`, you also have to
make sure no one has ever called `configatron.foo.bar`.

Note that this is not backwards compatible. I'm not sure how much of a
problem that is, but I suspect many of these tweaks could be made
while preserving backwards compat.