From: Intransition Date: 2010-04-12T23:15:56+09:00 Subject: Re: attr_accessor, but for a boolean On Apr 11, 9:13 pm, Daniel N wrote: > Unfortunately this doesn't support safe? being boolean always.  It could be > something other than true false (may not be a problem) > > If you want to use attr_accessor rather than simply aliasing the method I'd > suggest > > def safe? >   !!safe > end > > This way the expectation of a ? method to return a boolean is preserved. I used to think this too, but... I think it was Austin Ziegler who made the argument against using anything like "!!". In ruby it isn't necessary. Anything that isn't nil or false is evaluated by conditionals as true. I haven't once seen a case where it mattered if a boolean was returned rather than the underlying value.