From: Josh Cheek Date: 2010-04-13T05:31:26+09:00 Subject: Re: attr_accessor, but for a boolean --000e0cd13a665f012f0484100715 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Apr 12, 2010 at 1:29 PM, Intransition wrote: > > it's nicer to see true/false in the output. > > At other times you might want to see the underlying attribute. It's > easier to write '!!obj.safe?' then it is to write > 'obj.instance_eval{ @safe }'. > > I can understand wanting it either way depending on the situation. But > for an attr method I think it's probably best to side on doing less > rather than more, i.e. just making :a? a normal reader. But I wouldn't > bemoan it working one way or the other really. > > You could define save= , the setter for @safe safe , the getter for @safe safe? , returns !!safe Then you can use whichever makes the most sense for your particular use. --000e0cd13a665f012f0484100715--