sam / harbor

Harbor is a Ruby Web Framework.
https://github.com/sam/harbor
MIT License
3 stars 6 forks source link

Harbor::Configuration methods should default to returning new containers #7

Closed sam closed 12 years ago

sam commented 12 years ago

Right now, config.redis.host = "redis.example" would raise a NoMethodError since config.redis hasn't been set. Harbor::Configuration should overwrite method_missing and register a new Harbor::Configuration instance for you if the entry isn't registered.

This would break cases where you wanted a nil, but would make the more common case of wanting to organize your configuration easier/simpler so the answer to that would be to just explicitly set nil or false if that's what you wanted.

sam commented 12 years ago

This was added in b25c2de31f.

The equality/nil overrides were not done since it couldn't be accomplished consistently. Better to not have any magic than half-working magic.