From: Phillip Gawlowski Date: 2011-05-01T20:20:14+09:00 Subject: Re: Understanding Ruby Inside Out On Sun, May 1, 2011 at 11:29 AM, Konstantin Ka wrote: > > Even if the basic commands are embedded within the C of Ruby itself, > aren't there already pre-defined (let's call them "2nd tier") methods > based on Ruby code already within those superclasses? Well, the Ruby interpreter is written in whatever host language is used (C, Java, &c.). Ruby's methods are usually (but not nearly always) defined in Ruby code building upon the capabilities of the interpreter. More or less, you have to look at two different things: The Ruby standard library, and the Ruby interpreter. How you start depends on whether you like to go from amino acids to organs, to organisms or the other way around. > Would there be any way that Ruby-Newbie-mme could come along, have a > look inside the preprogrammed String class and see written there in Ruby > language > >>  def rand >>    self.split('').shuffle.join >>  end > > ... because that would enable me to go "Oh, sure! It splits the string, > shuffles it, and joins it back together. Sounds easy!" even if, to find > out what some of those "1st tier" methods like .split actually do, I'd > have to go look at the C code. Of course. I grabbed a random example out of : http://ruby-doc.org/core/classes/File.src/M000006.html The source for a given method right there. This is the File#atime function, reachable from here: http://ruby-doc.org/core/classes/File.html (BTW: I hate frames), just click on a method name. -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.