From: "shevegen (markus heiler)" Date: 2012-05-20T16:16:53+09:00 Subject: [ruby-core:45147] [ruby-trunk - Feature #6470] Make attr_accessor return the list of generated method Issue #6470 has been updated by shevegen (markus heiler). Yes, they are public. If I understood them correctly, they are the same as this in pure ruby code: attr_accessor :foo def foo @foo end def foo=(i) @foo = i end I found that I personally only need attr_reader, attr_writer and attr_accessor. I have not found a use case for attr alone yet. ---------------------------------------- Feature #6470: Make attr_accessor return the list of generated method https://bugs.ruby-lang.org/issues/6470#change-26726 Author: rupert (Robert Pankowecki) Status: Open Priority: Normal Assignee: Category: Target version: attr_accesor currently returns nil. It would be more helpful if it return list of generated methods so that it can become an argument to other methods like :private or :protected. That way private accessors can still be defined at top of the class and be private without changing the visibility of next methods. class Something private *attr_accessor :user, :action # IMHO This is nice # private attr_accessor :user, :action # <-- would be even better if :private method accepted arrays def initialize(user, action) self.user = user self.action = action end def public_method user.do_something(action) end end VS class Something private; attr_accessor :user, :action; public # IMHO Hack!! def initialize(user, action) self.user = user self.action = action end def public_method user.do_something(action) end end VS class Something def initialize(user, action) self.user = user self.action = action end def public_method user.do_something(action) end private attr_accessor :user, :action # IMHO Does not look nice at bottom of the class definition end -- http://bugs.ruby-lang.org/