What makes Ruby work?

This is not a guide. It's a question. And I hope there is a Ruby crack
reading this who can answer. (Be kind. It's my first post. :-)

I've been learning the basics of Ruby for a bit over a week now and
while I understand those basics I can't help but wonder how all of those
basic methods work inside ruby.

In the past I also noticed that the best way to become good at anything
is to understand every detail of it (I had an education in medicine and
if you know what molecules and cells do if you throw them together, the
function and malfunctions of organs s just basic logic)

That being said, since everything in Ruby is an Object and in one way or
another belongs to the Object-Class, I'd like to see the code of that.

I want to see what basic methods do in code form. Even Kernel methods
like ... I don't know... .sort for example.

Since Kernel is a subclass of Module and Module a subclass of Object, in
one of those 3 classes every (Kernel) method had to have been defined at
one point, right?

So, is there any way I can see the class codes... or even let the code
be printed in irb via a method? Like "print sort.code" and it prints a
string with the original code inside, that would rock. (Well obviously
it would be looking for an array to sort first so that wouldn't work but
... I hope you get what I mean)

Especially interesting woud be that since every method seems to be
defined with other methods, where did the first methods come from?

How would one define the method ".def"?

Or maybe I am thinking in an entirely wrong direction? Especially since
> Class.superclass #=> Module
> Module.superclass #=> Object
# but
> Object.class #=> Class

... which I can't wrap my head around.


These questions seem fairly basic to me, but none of the beginner guides
I found even came close to explaining this. So please point me in the
right direction.

Thank you,

-Konstantin

-- 
Posted via http://www.ruby-forum.com/.