[holy ruby programmers batman!] Potential addition: nil safe chaining

Tim Connor timocratic at gmail.com
Fri Dec 21 16:44:57 EST 2007


Hey, Giles.  Are you interested in this functionality?
http://pastie.caboo.se/131472

I'd convert the tests to specs of course, but this is what I have, and
is the easiest way to illustrate the behavior.

I've been accused of egregious Law of Demeter with this, but I think
it is a nice bit of sugar for conditionals where you want to call a
method on something if it exists and otherwise return the nil
reference.  Like anything, if abused it'd be a bad thing.

Tim


More information about the Utilitybelt-tinkering mailing list