From: Rick DeNatale Date: 2009-06-28T23:24:25+09:00 Subject: Re: Attr Methods and object setters On Sun, Jun 28, 2009 at 10:18 AM, David A. Black wrote: > At the risk of someone saying that I've made it too cryptic, it could > be one line shorter: > >  Nothing = Object.new >  def name(value = Nothing) >    @name = value unless value == Nothing >  end > Actually the second line IS necessary Nothing = Object.new def name(value = Nothing) @name = value unless value == Nothing end name 42 # => 42 name # => nil -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale