From: "Carlo E. Prelz" Date: 2012-11-27T17:34:35+09:00 Subject: Re: Novice: Understanding instance 'variables' and methods Subject: Re: Novice: Understanding instance 'variables' and methods Date: Tue 27 Nov 12 05:26:46PM +0900 Quoting Steve Tu (lists@ruby-forum.com): > Then I have automatically created two methods in My_class - the > reader/writer - both with a method name of 'test'. No. There cannot be two methods with the same name in Ruby. One method (the getter) is 'test'. The other (the setter) is called 'test='. You can always have a look at what methods an objects answers to, with the 'methods' method. For your class, p my_c.methods [:test, :test=, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] The first two in the list are the ones you added with attr_accessor. Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)