James Gray
2/11/2005 5:52:00 PM
On Feb 11, 2005, at 11:35 AM, Ghelani, Vidhi wrote:
> So I had one more question then. What if (using
> the example you have given me) we wanted to run all the classes, but
> they were obviously in different files. Does that mean that by giving
> the command
> ruby another.rb
> all the files are getting executed , since the other classes are
> superclasses of that class?
See the line in myclass.rb:
require 'superclass'
?
That loads the other file. Then in another.rb, you have:
require 'myclass'
That loads the myclass.rb file, which we've just seen loads
superclass.rb. That's how they all get pulled in.
> Also What do you mean by " All Ruby code is executed as it is seen by
> the
> interpreter." What is the interpreter out here? #Sorry if this is a
> stupid
> #question!
In Java, the program "java" is an interpreter. It reads Java bytecode
to make a program run. For Ruby, our interpreter is "ruby". "ruby"
just doesn't need the code to pass through a compiler first.
Hope that helps.
James Edward Gray II