From: Gregory Brown Date: 2009-06-28T22:18:07+09:00 Subject: Re: Attr Methods and object setters On Sat, Jun 27, 2009 at 11:26 PM, Daniel DeLorme wrote: > Gregory Brown wrote: >> >> Anyway, here's a better way to solve the problem that probably >> addresses your concerns: >> >> def name(*args) >>       return @name if args.empty? >>      @name = args.first >> end > > Another way to do this is to use some kind of singleton object > > Nothing = Object.new > def name(value = Nothing) >  @name = value unless value == Nothing >  @name > end Ooh, neat trick. Thanks for sharing. -greg