From: Joel VanderWerf Date: 2008-07-08T08:46:25+09:00 Subject: Re: Where is the .rb for sockets? 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. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407