From: Joel VanderWerf Date: 2003-01-22T05:02:36+09:00 Subject: Re: accessors for module instance vars Phil Tomson wrote: > Now this works ok, but I'm wondering if there's a way to create the > accessor methods for the Evolvable module automatically like with > attr_accessor and attr_reader. The problem with attr_accessor is that it > creates an instance method, not a module method - is there a way to > automatically create a module method? > > Phil > > irb(main):001:0> module M irb(main):002:1> class << self; attr_accessor :foo; end irb(main):003:1> end nil irb(main):004:0> M.foo nil irb(main):005:0> M.foo = 4 4 irb(main):006:0> M.foo 4