Some Ruby lesser used functions
Archive - Originally posted on "The Horse's Mouth" - 2008-07-26 07:13:31 - Graham EllisTidying up (as one does after the recent server move!), I came across a list of functions in Ruby which are important at times, but not exactly top of the list ... and I thought I would share them here - with a few words on each - in the hope that I might save someone a lot of hairpulling at some stage in the future!
abort - teminate your program
at_exit - register code to be run when you exit
autoload - register a class to be loaded only when used
caller - return the current execution stack
eval - evalute the given string as ruby code
exec - exit and run the given command in its place
fork - create a child process (could be a whole module on this!)
sub and gsub - perform string substitution (see under regular expressions)
lambda, proc - convert a block into a proc object
readline - same as gets but throws exception at eof
select - checks for availabilty of inputs without blocking
sleep - suspend operation for n seconds
srand - seed the random number generator
syscall, system - run system calls and commands
trap - set a signal handler (e.g. if you need to catch ^C)