It is opposite of what you described here.
Object.extend(MyClass, {
  // "instance" stuff

});

Object.extend(MyClass.prototype, {
   // "static" stuff
});

The properties added to prototype is shared by all the instance
object, so it is static.

On Jan 28, 6:22 am, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
> Hey Ingo,
>
> ingo a écrit :
>
> > is it possible to define class methods/variables in prototype? I am
> > migrating a bunch of classes to the prototypeClass.create(); syntax,
> > and some of them are implemented as a singleton, so they need to
> > define a class method:
>
> It's unrelated to Prototype, actually, it's raw JS.  Just put your
> methods at the object (i.e. class, in classical OOP thinking) level, not
> at the constructor's prototype level:
>
> var MyClass =Class.create();
>
> Object.extend(MyClass, {
>   // "static" stuff
>
> });
>
> Object.extend(MyClass.prototype, {
>   // "instance" stuff
>
> });
>
> --
> Christophe Porteneuve a.k.a. TDD
> "[They] did not know it was impossible, so they did it." --Mark Twain
> Email: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to