$super is a reference to the current function in the superclass. So,
Animal = Class.create({
initialize: function(legs) {
this.legs = legs;
}
});
Dog = Class.create(Animal, {
initialize: function($super, legs, name) {
$super(legs);
this.name = name;
}
});
new Dog(4, "Zombie")
Best,
-Nicolas
On Dec 20, 2007 5:27 PM, Matt Foster <[EMAIL PROTECTED]> wrote:
>
> Greetings,
>
> I had a question about the $super argument that I wasn't
> able to find in documentation, searching etc. What exactly is the
> $super argument. Is it a reference to the super class's prototype
> function? Or is it an instantiated object of the super class that is
> passed to the subclass's method?
>
> I am completely confuzzled on this one, my typical method of just
> reading the source has left me worse off. Can anyone explain this
> concept or perhaps point me to a resource which properly defines it?
>
> Thanks in advance,
> Matt
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---