From a non-Ruby guy, here is the scoop:

Ruby has a keyword "super" that is available within all methods.  It 
allows you to call the parent function of the same name.

In php I write:
public function mymethod($arg) {
  parent::mymethod($arg); // equivalent to Ruby super($arg)
}

So this JS implementation basically has $super refer to the parent 
method of the same name so you can call $super()

"$super" is used instead of "super" because "super" is a reserved word 
in JS.

The sugar is that extended classes automagically pass a reference of the 
parent function into child function only for methods that have a $super 
argument (detected when the child function is converted to a string with 
toString()).

- Ken Snyder

PS. great interjection of "confuzzled"!


Matt Foster 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to