From: Dennis Misener Date: 2003-12-15T11:21:59+09:00 Subject: Q: How to convert hashed parameters to local variables? In my efforts to write yet another template language {I know, I know ..grin}, I find myself wanting to provide simple named parameters ala Mason. I'd like to insulate the user from the mechanics of "dereferencing" the hashed parameters. What I desire is an implementation for "parameters" such that: def announce(args) parameters(args,:age=>21) "My name is #{first} #{last} and my age is #{age}" end announce(:first=>'John', :last=>'Smith') generates "My name is John Smith and my age is 21" I was thinking something like .... def parameters(args,defaults) args=defaults.update(args) args.each_pair do |key,value| < generate a object with the name 'key' and value 'value' in the scope of the calling routine > end end But the <...> portion has eluded me. Any assistance would be appreciated.