From: Jeremy Kemper Date: 2009-08-24T11:18:45+09:00 Subject: [ruby-core:25066] [Bug #1983] Struct doesn't define instance methods for valid method names Bug #1983: Struct doesn't define instance methods for valid method names http://redmine.ruby-lang.org/issues/show/1983 Author: Jeremy Kemper Status: Open, Priority: Normal Category: core, Target version: 1.9.2 ruby -v: ruby 1.9.2dev (2009-08-16) [i386-darwin9.8.0] >> foo = Struct.new(:foo?, :foo!).new(true, true) => # >> foo.foo? NoMethodError: undefined method `foo?' for # from (irb):3 from /usr/local/bin/irb19:12:in `
' >> foo.foo! NoMethodError: undefined method `foo!' for # from (irb):4 from /usr/local/bin/irb19:12:in `
' >> foo[:foo?] => true >> foo[:foo!] => true I think this is because foo?= and foo!= are not valid setter methods. By why not generate the reader and skip the setter, then? ---------------------------------------- http://redmine.ruby-lang.org