From: John Maclean Date: 2008-07-08T08:56:36+09:00 Subject: Re: Where is the .rb for sockets? On Tue, 8 Jul 2008 08:46:25 +0900 Joel VanderWerf wrote: > John Maclean wrote: > > Normally I use `ri foo` whenever I want to read up on something. > > There's also the ruby library, (/usr/lib/ruby/1.8), as there are > > some goodies and clues in the comments. `locate foo.rb` normally > > does it but in the case for TCPSocket, Socket and IPSocket there's > > nothing to be found. Where is it hidden? > > > > Socket.ancestors > > [Socket, BasicSocket, IO, File::Constants, Enumerable, Object, > > PP::ObjectMixin, Kernel] > > > > I'm guessing that it's either part of IO or something writen in C. > > Am I right? Is there a Socket.rb file anywhere? > > Socket lib is written in C, but there are ri docs for it: > > > $ ri Socket | head -n 20 > ---------------------------------------------------------- Class: > Socket Class Socket provides access to the underlying operating system > socket implementations. It can be used to provide more operating > system specific functionality than the protocol-specific socket > classes but at the expense of greater complexity. In particular, > the class handles addresses using +struct sockaddr+ structures > packed into Ruby strings, which can be a joy to manipulate. > > Exception Handling > Ruby's implementation of Socket causes an exception to be raised > based on the error generated by the system dependent > implementation. This is why the methods are documented in a way > that isolate Unix-based system exceptions from Windows based > exceptions. If more information on particular exception is > needed please refer to the Unix manual pages or the Windows WinSock > reference. > > Documentation by > * Zach Dennis > > > Does this work on your system? > > Not all of the methods have docs, tho. > yes that does work. I have those docs. where is the c code for io or tcp stuff? it it not this stuff... /home/jayeola/bx/rb/ruby/1.8/io: total used in directory 12 available 16697500 drwxr-xr-x 2 jayeola jayeola 4096 2008-06-27 03:30 . drwxr-xr-x 31 jayeola jayeola 4096 2008-07-06 10:53 .. -rw-r--r-- 1 jayeola jayeola 408 2008-06-27 03:30 nonblock.rb