avdi / naught

A toolkit for building Null Object classes in Ruby
MIT License
1.05k stars 53 forks source link

Null-aware Proxies #6

Open avdi opened 11 years ago

avdi commented 11 years ago

Wrap myvalue and intercept each method call, wrapping the return value. If ANY call returns nil, replace it with a null object:

SomeConversionFunc(myvalue).foo.bar.baz # => <null>

Counterpoint: without Demeter violations this wouldn't be needed ;-)