From: Daniel N Date: 2010-04-12T10:03:13+09:00 Subject: Re: attr_accessor, but for a boolean --00504502ad538152550483ffb529 Content-Type: text/plain; charset=ISO-8859-1 There's no built in way in ruby for it to know that you're going to put a boolean in there. You'll need to do something like class Mambo attr_writer :safe def safe? !!@safe end end HTH Daniel On 12 April 2010 11:00, Albert Schlef wrote: > Let's say I have this code: > > class Mambo > attr_accesstor :safe > end > > Now, > > 'safe', in my case, is a boolean. Problem is, the getter will be named > 'safe', whereas I want it to be 'safe?'. > > In other words, how do I make the getter 'safe?' and the setter 'safe' > ? > -- > Posted via http://www.ruby-forum.com/. > > --00504502ad538152550483ffb529--