Permalink
Browse files

Merge RDoc changes from HEAD.

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent af5d40c commit 143f8a86a46b7ec38ad5382b8fe00e80785c1212 @drbrain drbrain committed Aug 4, 2006
View
@@ -1,44 +1,51 @@
-#
+#--
# finalizer.rb -
# $Release Version: 0.3$
# $Revision: 1.4 $
# $Date: 1998/02/27 05:34:33 $
# by Keiju ISHITSUKA
+#++
#
-# --
-#
-# Usage:
+# Usage:
#
+# add dependency R_method(obj, dependant)
# add(obj, dependant, method = :finalize, *opt)
# add_dependency(obj, dependant, method = :finalize, *opt)
-# add dependency R_method(obj, dependant)
#
+# delete dependency R_method(obj, dependant)
# delete(obj_or_id, dependant, method = :finalize)
# delete_dependency(obj_or_id, dependant, method = :finalize)
-# delete dependency R_method(obj, dependant)
+#
+# delete dependency R_*(obj, dependant)
# delete_all_dependency(obj_or_id, dependant)
-# delete dependency R_*(obj, dependant)
+#
+# delete dependency R_method(*, dependant)
# delete_by_dependant(dependant, method = :finalize)
-# delete dependency R_method(*, dependant)
+#
+# delete dependency R_*(*, dependant)
# delete_all_by_dependant(dependant)
-# delete dependency R_*(*, dependant)
+#
+# delete all dependency R_*(*, *)
# delete_all
-# delete all dependency R_*(*, *)
#
+# finalize the dependant connected by dependency R_method(obj, dependtant).
# finalize(obj_or_id, dependant, method = :finalize)
# finalize_dependency(obj_or_id, dependant, method = :finalize)
-# finalize the dependant connected by dependency R_method(obj, dependtant).
+#
+# finalize all dependants connected by dependency R_*(obj, dependtant).
# finalize_all_dependency(obj_or_id, dependant)
-# finalize all dependants connected by dependency R_*(obj, dependtant).
+#
+# finalize the dependant connected by dependency R_method(*, dependtant).
# finalize_by_dependant(dependant, method = :finalize)
-# finalize the dependant connected by dependency R_method(*, dependtant).
+#
+# finalize all dependants connected by dependency R_*(*, dependant).
# finalize_all_by_dependant(dependant)
-# finalize all dependants connected by dependency R_*(*, dependant).
+#
+# finalize all dependency registered to the Finalizer.
# finalize_all
-# finalize all dependency registered to the Finalizer.
#
+# stop invoking Finalizer on GC.
# safe{..}
-# stop invoking Finalizer on GC.
#
module Finalizer
View
@@ -11,25 +11,22 @@
#
# == Description
#
-# +ftools+ adds several (class, not instance) methods to the File class, for copying, moving,
-# deleting, installing, and comparing files, as well as creating a directory path. See the
-# File class for details.
+# ftools adds several (class, not instance) methods to the File class, for
+# copying, moving, deleting, installing, and comparing files, as well as
+# creating a directory path. See the File class for details.
#
-# +fileutils+ contains all or nearly all the same functionality and more, and is a recommended
-# option over +ftools+.
-#
-
-
+# FileUtils contains all or nearly all the same functionality and more, and
+# is a recommended option over ftools
#
# When you
#
# require 'ftools'
#
-# then the File class aquires some utility methods for copying, moving, and deleting files, and
-# more.
+# then the File class aquires some utility methods for copying, moving, and
+# deleting files, and more.
#
-# See the method descriptions below, and consider using +fileutils+ as it is more
-# comprehensive.
+# See the method descriptions below, and consider using FileUtils as it is
+# more comprehensive.
#
class File
end
@@ -96,8 +93,8 @@ def copy(from, to, verbose = false)
#
# Moves a file +from+ to +to+ using #syscopy. If +to+ is a directory,
- # copies from +from+ to <tt>to/from</tt>. If +verbose+ is true, <tt>from -> to</tt>
- # is printed.
+ # copies from +from+ to <tt>to/from</tt>. If +verbose+ is true, <tt>from ->
+ # to</tt> is printed.
#
def move(from, to, verbose = false)
to = catname(from, to)
@@ -127,7 +124,7 @@ def move(from, to, verbose = false)
alias mv move
#
- # Returns +true+ iff the contents of files +from+ and +to+ are
+ # Returns +true+ if and only if the contents of files +from+ and +to+ are
# identical. If +verbose+ is +true+, <tt>from <=> to</tt> is printed.
#
def compare(from, to, verbose = false)
View
@@ -19,6 +19,7 @@
$RCS_ID=%q$Header$
+# getopts is obsolete. Use GetoptLong.
def getopts(single_options, *options)
boolopts = {}
View
@@ -12,21 +12,23 @@
require "thread"
#
-# +GServer+ implements a generic server, featuring thread pool management, simple logging, and
-# multi-server management. See <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for
-# an example of +GServer+ in action.
-#
-# Any kind of application-level server can be implemented using this class. It accepts
-# multiple simultaneous connections from clients, up to an optional maximum number. Several
-# _services_ (i.e. one service per TCP port) can be run simultaneously, and stopped at any time
-# through the class method <tt>GServer.stop(port)</tt>. All the threading issues are handled,
-# saving you the effort. All events are optionally logged, but you can provide your own event
-# handlers if you wish.
+# GServer implements a generic server, featuring thread pool management,
+# simple logging, and multi-server management. See HttpServer in
+# <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for an example of
+# GServer in action.
+#
+# Any kind of application-level server can be implemented using this class.
+# It accepts multiple simultaneous connections from clients, up to an optional
+# maximum number. Several _services_ (i.e. one service per TCP port) can be
+# run simultaneously, and stopped at any time through the class method
+# <tt>GServer.stop(port)</tt>. All the threading issues are handled, saving
+# you the effort. All events are optionally logged, but you can provide your
+# own event handlers if you wish.
#
# === Example
#
-# Using +GServer+ is simple. Below we implement a simple time server, run it, query it, and
-# shut it down. Try this code in +irb+:
+# Using GServer is simple. Below we implement a simple time server, run it,
+# query it, and shut it down. Try this code in +irb+:
#
# require 'gserver'
#
@@ -60,14 +62,16 @@
# GServer.stop(10001)
# # or, of course, "server.stop".
#
-# All the business of accepting connections and exception handling is taken care of. All we
-# have to do is implement the method that actually serves the client.
+# All the business of accepting connections and exception handling is taken
+# care of. All we have to do is implement the method that actually serves the
+# client.
#
# === Advanced
#
-# As the example above shows, the way to use +GServer+ is to subclass it to create a specific
-# server, overriding the +serve+ method. You can override other methods as well if you wish,
-# perhaps to collect statistics, or emit more detailed logging.
+# As the example above shows, the way to use GServer is to subclass it to
+# create a specific server, overriding the +serve+ method. You can override
+# other methods as well if you wish, perhaps to collect statistics, or emit
+# more detailed logging.
#
# connecting
# disconnecting
@@ -76,8 +80,8 @@
#
# The above methods are only called if auditing is enabled.
#
-# You can also override +log+ and +error+ if, for example, you wish to use a more sophisticated
-# logging system.
+# You can also override +log+ and +error+ if, for example, you wish to use a
+# more sophisticated logging system.
#
class GServer
View
@@ -7,29 +7,9 @@
# You can redistribute and/or modify it under the same terms as Ruby.
#
# $Id$
-#--
+#
# TODO:
# - scope_id support
-#++
-#
-#== Example
-#
-# require 'ipaddr'
-#
-# ipaddr1 = IPAddr.new "3ffe:505:2::1"
-#
-# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
-#
-# p ipaddr1.to_s #=> "3ffe:505:2::1"
-#
-# ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
-#
-# p ipaddr2.to_s #=> "3ffe:505:2::"
-#
-# ipaddr3 = IPAddr.new "192.168.2.0/24"
-#
-# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
-
require 'socket'
unless Socket.const_defined? "AF_INET6"
@@ -75,8 +55,27 @@ def getaddress(s)
end
end
-# IPAddr provides a set of methods to manipulate an IP address. Both
-# IPv4 and IPv6 are supported.
+# IPAddr provides a set of methods to manipulate an IP address. Both IPv4 and
+# IPv6 are supported.
+#
+# == Example
+#
+# require 'ipaddr'
+#
+# ipaddr1 = IPAddr.new "3ffe:505:2::1"
+#
+# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
+#
+# p ipaddr1.to_s #=> "3ffe:505:2::1"
+#
+# ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
+#
+# p ipaddr2.to_s #=> "3ffe:505:2::"
+#
+# ipaddr3 = IPAddr.new "192.168.2.0/24"
+#
+# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
+
class IPAddr
IN4MASK = 0xffffffff
View
@@ -1,9 +1,8 @@
# logger.rb - saimple logging utility
# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>.
+require 'monitor'
-# = logger.rb
-#
# Simple logging utility.
#
# Author:: NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
@@ -13,14 +12,6 @@
# license; either the dual license version in 2003, or any later version.
# Revision:: $Id$
#
-# See Logger for documentation.
-#
-
-
-require 'monitor'
-
-
-#
# == Description
#
# The Logger class provides a simple but sophisticated logging utility that
@@ -152,7 +143,7 @@
# 2. Log4r (somewhat) compatible interface.
#
# logger.level = Logger::INFO
-#
+#
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
#
#
View
@@ -1,5 +1,14 @@
+# The Mail class represents an internet mail message (as per RFC822, RFC2822)
+# with headers and a body.
class Mail
+ # Create a new Mail where +f+ is either a stream which responds to gets(),
+ # or a path to a file. If +f+ is a path it will be opened.
+ #
+ # The whole message is read so it can be made available through the #header,
+ # #[] and #body methods.
+ #
+ # The "From " line is ignored if the mail is in mbox format.
def initialize(f)
unless defined? f.gets
f = open(f, "r")
@@ -34,14 +43,19 @@ def initialize(f)
end
end
+ # Return the headers as a Hash.
def header
return @header
end
+ # Return the message body as an Array of lines
def body
return @body
end
+ # Return the header corresponding to +field+.
+ #
+ # Matching is case-insensitive.
def [](field)
@header[field.capitalize]
end
View
@@ -1,4 +1,4 @@
-#
+#--
# mutex_m.rb -
# $Release Version: 3.0$
# $Revision: 1.7 $
@@ -7,22 +7,26 @@
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# modified by matz
# patched by akira yamada
+#++
+#
+# == Usage
+#
+# Extend an object and use it like a Mutex object:
+#
+# require "mutex_m.rb"
+# obj = Object.new
+# obj.extend Mutex_m
+# # ...
#
-# --
-# Usage:
-# require "mutex_m.rb"
-# obj = Object.new
-# obj.extend Mutex_m
-# ...
-# extended object can be handled like Mutex
-# or
-# class Foo
-# include Mutex_m
-# ...
-# end
-# obj = Foo.new
-# this obj can be handled like Mutex
+# Or, include Mutex_m in a class to have its instances behave like a Mutex
+# object:
#
+# class Foo
+# include Mutex_m
+# # ...
+# end
+#
+# obj = Foo.new
module Mutex_m
def Mutex_m.define_aliases(cl)
Oops, something went wrong.

0 comments on commit 143f8a8

Please sign in to comment.