From: Kedar Mhaswade Date: 2010-12-09T23:12:04+09:00 Subject: Convetion regarding accessing attributes (from within instance methods). I observed that once I have defined attr_accessor for an attribute of a class, I can access it with or without an '@' leading the name of attribute (i.e. both [1] and [2] work correctly). I find accessing it without leading '@' more natural (when there are no conflicts with local variables). What is the Ruby community convention in this regard? Regards, Kedar [1] #!/usr/bin/env ruby class Car attr_accessor :color def initialize(color) @color = color end def print_color puts @color end end c = Car.new("blue") c.print_color [2] #!/usr/bin/env ruby class Car attr_accessor :color def initialize(color) @color = color end def print_color puts color end end c = Car.new("blue") c.print_color -- Posted via http://www.ruby-forum.com/.