From: Intransition Date: 2010-08-27T01:38:13+09:00 Subject: Re: #attr back to 1.8.6 an older behavior? On Aug 26, 10:39 am, Brian Candler wrote: > Thomas Sawyer wrote: > > What happened to dropping the optional true/false parameter from #attr > > in 1.9? About a year or so ago, the method was changed to support > > multiple symbols, and if you wanted a writer you just add one with an > > '=' on the end, e.g. > > >   attr :x, :x= > > FWIW, it looks like 1.9.1 doesn't allow attr :x= anyway (reader > attributes only) I don't really care about the 'x=' option either way, though I do think it is a nice convenience. I do think dropping the optional true/ false option is a good thing though for three reasons. 1) true/false parameters are very unreadable. They give you no information whatsoever as to what behavior is being toggled, 2) multiple symbols can be given, and 3) it can be useful to override #attr to take options, eg. attr :x, :default => 10 I have found this useful in a number of cases, and the idiom is very common with variants of attr too. Having to take the true/false parameter into account, while not a huge deal, does leave open an argument ambiguity, since a Hash evaluates as true.