Attr_accessor, attr_reader question

Is there a way that I can use attr_accessor or attr_reader so that I
can access a boolean variable with a ‘?’ appended to the end of the name?
For example:
class Test
attr_accessor :bit
end
t = Test.new

That will allow ‘t.bit = true’, or ‘if t.bit’ but it won’t do ‘if t.bit?’,
which is clearer, IMO.

-Michael

Hi,

Is there a way that I can use attr_accessor or attr_reader so that I
can access a boolean variable with a ‘?’ appended to the end of the name?
For example:
class Test
attr_accessor :bit
alias bit? bit

···

At Sun, 21 Jul 2002 17:00:50 +0900, Michael Brailsford wrote:

end


Nobu Nakada