From: Stefan Rusterholz Date: 2007-08-18T22:32:50+09:00 Subject: Re: Emulating a Groovy feature? John Wells wrote: > Guys, > > There's something called Safe Navigation in Groovy > (http://groovy.codehaus.org/Statements#Statements-Safenavigation) that I > find very appealing. > > So, Groovy will allow you to safely walk an object graph, even if that > graph has nulls in it (the walk will short circuit): > > def foo = null > def bar = foo?.something?.myMethod() > assert bar == null > > Is there an easy way to hack an equivalent out in Ruby? > > Thanks, > John Good to see that I'm not alone on this :) I still intend to write an RCR for this. You might want to read through http://www.ruby-forum.com/topic/115720 Regards Stefan -- Posted via http://www.ruby-forum.com/.