From: Suraj Kurapati Date: 2007-11-16T02:48:07+09:00 Subject: Re: ruby wish-list Marc Heiler wrote: > (By the way, an accessor_read that can query variables with ? on the end > would be nice in std ruby too... I am not complaining at all, ruby is so > flexible, I already use this for my code and i love it, like @file.readable? > that queries a "special" reader accessor... i think it reads nicer than > @file.readable but this is just my opinion) Do you mean that attr_accessor treats symbols with a question mark differently by creating a "symbol_without_question=" writer method and a "symbol_with_question" reader method? For example: class Foo attr_acessor :readable? # defines Foo#readable= and Foo#readable? end f = Foo.new f.readable? #=> nil f.readable = 99 f.readable? #=> 99 This would be very useful, because it would make the following workaround obsolete: class Foo attr_writer :readable # only defines Foo#readable= def readable? @readable end end Oh wishing star, here is another wish for you! :-) Thanks for your consideration. -- Posted via http://www.ruby-forum.com/.