------art_62462_20143990.1186239574174
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 8/2/07, Todd Burch <promos / burchwoodusa.com> wrote:
>
> unknown wrote:
> >
> > Unless I'm missing a subtlety, you could also do that as the somewhat
> > more concise:
> >
> >    send(tool) if tool
> >
> >
> > David
>
> Thanks for the shortcuts - I didn't know either of these techniques
> could be done.  In my example, I do other things inside each WHEN
> statement to set up the call, but I condensed my example to post.
>
> Thanks!   Todd


You could still get the same benefit by setting up a hash of name-value
papers, e.g.,

actions  
  "drill" :do_the_drill_thang,
  "cut"  :slice_and_dice,
  ...
}

send(actions[tool]) if tool

An alternative, maybe better, idea would be to define method aliases, e.g.,

method_alias :drill, :do_the_drill_thang
...

send(tool) if tool

dean

-- 
Dean Wampler
http://www.objectmentor.com
http://www.aspectprogramming.com
http://www.contract4j.org

------art_62462_20143990.1186239574174--