On 13 mar, 17:10, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
[snip]
>
> Check this out:
>
> Class.create = function(base) {
> return function() {
> if ((base) && base.prototype.initialize)
> base.prototype.initialize.apply(this, arguments);
> this.initialize.apply(this, arguments);
> }
>
> };
>
This sounds good, in theory, but only if everything is declared inside
the inditialize function. I came across this thread looking for a way
to accomplish a basic inheritance in JS (instead of doing
Object.extend({}, base)).
This example is also untested, but would this conception cause
issues ?
Class.create = function(base) {
return function() {
if ((base) && base.prototype.initialize) {
for (property in base.prototype) {
this.prototype[property] = base.prototype[property];
}
base.prototype.initialize.apply(this, arguments);
}
this.initialize.apply(this, arguments);
}
};
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---