Right, but the original's poster was looking for precisely a way to chance a property in the main function ("class") and have that change instantly propagate to all instances.

On 6/21/06, Andrew Tetlaw <[EMAIL PROTECTED]> wrote:
On 21/06/06, Ryan Gahl <[EMAIL PROTECTED]> wrote:
> MyObject.prototype.bSwitch = true; is the correct way to achieve what you
> are looking for.

Personally I wouldn't recommend doing this because of the potential
for confusion.

MyObject.prototype.bSwitch = true; is not exactly a class property
because each instance can be changed individually.

You can set it like this, sure
MyObject.prototype.bSwitch = true

and then oMyInstance1.bSwitch = true and oMyInstance2.bSwitch = true

But if you then set oMyInstance1.bSwitch = false; it'll only change it
for the instance and not the class. Which means you are
reading/setting in different ways leading to potential
confusion/mistakes.

--
Andrew Tetlaw
htp://tetlaw.id.au
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to