Re:Yukihiro Matsumoto: “Ruby is designed for humans, not mac...
by jeltz on Sunday January 19, 2020 @09:18AM
(#22091535)
You can never access a property in Ruby from outside the object, you are always calling a method. Calling "attr :foo" just defines two methods, "foo" and "foo=" which then can be used to access the property.
I think this is a rather elegant solution to properties, that you always need to expose them with getters and setters and that properties and methods do not share the same namespace.
I think this is a rather elegant solution to properties, that you always need to expose them with getters and setters and that properties and methods do not share the same namespace.