Zayd Abdullah
2/4/2009 10:31:00 PM
[Note: parts of this message were removed to make it a legal post.]
Okay Cool!! Understood :) Thanks Guys. I need to put in some more Ruby time
On Wed, Feb 4, 2009 at 5:09 PM, Stefan Lang <
perfectly.normal.hacker@gmail.com> wrote:
> 2009/2/4 Zayd Connor <devrubygem@gmail.com>:
> > I'm confused with the difference between gems and classes. Are they
> > considered the same thing? I familiar with what a class is, but where do
> > gems fall into place. Do you use them sort of like an include in C\C++?.
> > Can someone give me a simple example.
> >
> > What about Modules? How are they used in Ruby?
>
> A module serves as namespace or as mixin (essentially
> a bag of methods).
>
> A class is a module (really, Class inherits from Module)
> that can be instantiated. Every object has a class that
> was used to instantiate it (you can get it with the "class"
> method).
>
> There is no such thing as a "gem" on the language
> level. A gem is a package of Ruby code. It can package
> any number of modules, classes, source files, and
> associated data files.
>
> The require function is used to load source files. It looks for
> source files on the load path ($LOAD_PATH). In order for
> require to find source files installed as gem, you have
> to load the gem (require "rubygems"; gem "some-gem").
>
> Ruby 1.9 ships with RubyGems and source files from gems
> are automatically on the load path.
>
> HTH,
> Stefan
>
>