I am trying to get a call to one of my class attribute attributes, but for some reason it is never called. Here is the code that will make this clearer:
class Test attr_reader :test def test=(val) puts 'Called' @test = val end def set_it(val) test = val end end obj = Test.new obj.set_it 5 puts obj.test => nil
The puts job at the end prints "nil". Adding a debug statement to test = indicates that it is never called. What am I doing wrong?
Update
I re-wrote this question in part, since I really did not understand the problem when I wrote. Therefore, the question is much more generalized.
ruby
Mark A. Nicolosi Feb 23 '09 at 3:16 2009-02-23 03:16
source share