Chef::Node::Attribute trying to call Hash methods on Array types

Howdy!

I’m trying to determine whether the following behavior constitutes a bug:

chef > node.default[:foo] = []
=> []
chef > node.set[:foo] << {:foo => “bar”}
=> {:foo=>“bar”}
chef > node[:foo].each { |entry| puts entry[:foo] }
NoMethodError: undefined method keys' for []:Array from /usr/lib64/ruby/gems/1.8/gems/chef-0.9.12/lib/chef/node/attribute.rb:250:inkeys’
from
/usr/lib64/ruby/gems/1.8/gems/chef-0.9.12/lib/chef/node/attribute.rb:248:in
each' from /usr/lib64/ruby/gems/1.8/gems/chef-0.9.12/lib/chef/node/attribute.rb:248:inkeys’
from
/usr/lib64/ruby/gems/1.8/gems/chef-0.9.12/lib/chef/node/attribute.rb:243:in
get_keys' from /usr/lib64/ruby/gems/1.8/gems/chef-0.9.12/lib/chef/node/attribute.rb:129:ineach’
from (irb):22
from :0

This happens because Chef::Node::Attribute’s each instance calls get_keys,
which in turn calls keys, which isn’t available for an array.

Is there an idiom I should be using which would avoid this issue?