From: "David A. Black" Date: 2005-10-05T22:58:02+09:00 Subject: Re: On NullClass or FalseClass#method_missing Hi -- On Wed, 5 Oct 2005, TRANS wrote: > Hi-- > > George Mischovitis' Nitro project uses OprnStruct-type containers > extensively for their end-user ease of use. I have been working with > him to make the solution more robust. ONe difficulty we've run into is > avoiding an error on an unregonized string of calls: > > o = OpenStructLikeClass > o.x #=> nil > o.x.y #=> NoMethodError > > George needs: > > o = OpenStructLikeClass > o.x #=> nil > o.x.y #=> nil Well, you could do: irb(main):001:0> def nil.method_missing(m); nil; end => nil irb(main):002:0> nil.x.y.z => nil but I'm not a big fan of messing with nil. Its behavior is standardized and heavily depended upon. David -- David A. Black dblack@wobblini.net