sethvargo/chef-sugar — pull request #49 by wfarr (2014-06-29 20:21:59+00:00)
Title: Use memoized namespace_options with defaults preserved

Previously, if the following code was in an attributes file:

``` ruby
require "chef/sugar"
if ubuntu_before_trusty?
# ...
end
```

That could would raise an exception due to `#vivified` relying
on the `@namespace_options` variable being defined, which only
happened in the context of a `namespace` call.

This change extracts the default value of `@namespace_options`
into a method that memoizes the object, and updates both methods
to use the new method.

This should prevent stack traces like this one from re-appearing:

```
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-sugar-2.0.0/lib/chef/sugar/node.rb:181:in `vivified'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-sugar-2.0.0/lib/chef/sugar/node.rb:158:in `rescue in method_missing'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-sugar-2.0.0/lib/chef/sugar/node.rb:156:in `method_missing'
```