From: dblack@... Date: 2006-11-30T00:22:19+09:00 Subject: Re: `attr_accessor` and predicate/question mark methods. Hi -- On Thu, 30 Nov 2006, Tim Becker wrote: > Hi, > I just stumbled across this weird behaviour and I'm puzzled that I've > not noticed it before. If I use `attr_accessor` to define a predicate > method, i.e. one ending in a question mark, the following happens: > > class Test > attr_accessor :weird? > end I get: irb(main):002:0> class Test irb(main):003:1> attr_accessor :weird? irb(main):004:1> end NameError: invalid attribute name `weird?' What version of Ruby are you using? David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org