From: Robert Klemme Date: 2012-09-01T21:28:55+09:00 Subject: Re: Constructor or a Method On Sat, Sep 1, 2012 at 2:20 PM, Rubyist Rohit wrote: > @Robert: > > So what I followed is if 'attr_accessor' is used, there is no need to > create Properties. But the confusion now arises how Ruby properties are > different than methods. The way of writing both are same. > > In my code in original post, I have a property: > > def name > @name > end > > Is this a property or a method? "name" is a method and "@name" is an instance variable. You can view this as a read only property. It's the same as just doing "attr_reader :name" btw. "Method" and "instance variable" are technical terms while "property" is more abstract - it describes the concept that an instance has some properties (which are typically implemented with accessor methods and instance variables). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/