Lets take this simple example

class NewBook

   attr_accessor :books

   def initialize
      @books = []
   end

   def some_method
      books[0] #(  the reader for books works fine and will recall the
class value @books, however)

      books = [4,5,6,7] # ( books will not actually get assigned here
unless I do self.books = [4,5,6,7] )
   end

end


Why do you have to use self.books= on writer methods, but you can simply
put books on reader method.

Very confused. Any help would be great.

-- 
Posted via http://www.ruby-forum.com/.