Hash magic in recipe

Hi

Not a direct chef related question, but some how I found it is interesting.

Q. In the recipe, I would able to use the node as the following ways

node[:myapp][:app_name]
node[‘myapp’][:app_name]
node[:myapp][‘app_name’]

Both are valid…May I ask what kind of magic is being used to achieve this?

Thanks.

Chef::Mash

It's a hash with indifferent access. I think the chained method syntax:

node.myapp.app_name

Probably still works as well.

There are a number of implementations, Chef used extlib a long time
ago, I know the Hashie gem has an indifferent accessible Hash too.

Cheers,

AJ

On 29 March 2013 00:24, Brian Akins brian@akins.org wrote:

Chef::Mash