On Fri, Sep 20, 2002 at 02:54:56PM +0900, Matthew, Graeme wrote:
> Hi all, its been a long but educational day :-)
> 
> Question:
> 
> If I create reader and writer attributes
> 
> eg
> attr_reader :code, :name, :telephone
> attr_writer :name, :telephone
> 
> Now self.code is a system generated code but how can I set it privately for
> example

attr_reader :code
generates an instance variable
@code 
as well as an accessor method, basically
def code
  return @code
end

Internal to the class you can just access the variable directly
@code = ...

BTW, attr_accessor creates a reader and writer on a given variable, so 
you could write
attr_accessor :name, :telephone
attr_reader :code

Hope this helps.

Cheers,
alan
-- 
Alan Chen
Digikata LLC
http://digikata.com