diff --git a/lib/README b/lib/README index 3a5a89c8d4..cfe7145307 100644 --- a/lib/README +++ b/lib/README @@ -24,7 +24,7 @@ irb.rb interactive ruby logger.rb simple logging utility mathn.rb extended math operation (obsolete) matrix.rb matrix calculation library -minitest/unit minimal drop-in replacement for test-unit +minitest/unit minimal drop-in replacement for test-unit mkmf.rb Makefile maker monitor.rb exclusive region monitor for thread mutex_m.rb mutex mixin diff --git a/lib/benchmark.rb b/lib/benchmark.rb index f3eaf340f4..84ed6c77f9 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -302,7 +302,7 @@ module Benchmark # A Job is a sequence of labelled blocks to be processed by the # Benchmark.bmbm method. It is of little direct interest to the user. # - class Job + class Job # # Returns an initialized Job instance. # Usually, one doesn't call this method directly, as new @@ -380,7 +380,7 @@ module Benchmark # Default caption, see also Benchmark::CAPTION CAPTION = " user system total real\n" - + # Default format string, see also Benchmark::FORMAT FORMAT = "%10.6u %10.6y %10.6t %10.6r\n" diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message index 18aea149bc..c01cdaab93 100644 --- a/lib/irb/lc/help-message +++ b/lib/irb/lc/help-message @@ -1,16 +1,16 @@ # -*- coding: US-ASCII -*- # -# irb/lc/help-message.rb - +# irb/lc/help-message.rb - # $Release Version: 0.9.6$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # Usage: irb.rb [options] [programfile] [arguments] - -f Suppress read of ~/.irbrc + -f Suppress read of ~/.irbrc -m Bc mode (load mathn, fraction or matrix are available) -d Set $DEBUG to true (same as `ruby -d') -r load-module Same as `ruby -r' @@ -27,14 +27,14 @@ Usage: irb.rb [options] [programfile] [arguments] --prompt-mode prompt-mode Switch prompt mode. Pre-defined prompt modes are `default', `simple', `xmp' and `inf-ruby' - --inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs. - Suppresses --readline. + --inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs. + Suppresses --readline. --simple-prompt Simple prompt mode --noprompt No prompt mode --tracer Display trace for each execution of commands. --back-trace-limit n Display backtrace top n and tail n. The default - value is 16. + value is 16. --irb_debug n Set internal debug level to n (not for popular use) -v, --version Print the version of irb # vim:fileencoding=us-ascii diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message index 78ba72ed35..57e8f23edf 100644 --- a/lib/irb/lc/ja/help-message +++ b/lib/irb/lc/ja/help-message @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# irb/lc/ja/help-message.rb - +# irb/lc/ja/help-message.rb - # $Release Version: 0.9.6$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # Usage: irb.rb [options] [programfile] [arguments] -f ~/.irbrc を読み込まない. @@ -18,14 +18,14 @@ Usage: irb.rb [options] [programfile] [arguments] -E enc ruby -E と同じ. -w ruby -w と同じ. -W[level=2] ruby -W と同じ. - --inspect 結果出力にinspectを用いる(bcモード以外はデフォルト). + --inspect 結果出力にinspectを用いる(bcモード以外はデフォルト). --noinspect 結果出力にinspectを用いない. --readline readlineライブラリを利用する. - --noreadline readlineライブラリを利用しない. + --noreadline readlineライブラリを利用しない. --prompt prompt-mode/--prompt-mode prompt-mode プロンプトモードを切替えます. 現在定義されているプ ロンプトモードは, default, simple, xmp, inf-rubyが - 用意されています. + 用意されています. --inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特 に指定がない限り, readlineライブラリは使わなくなる. --simple-prompt 非常にシンプルなプロンプトを用いるモードです. @@ -33,7 +33,7 @@ Usage: irb.rb [options] [programfile] [arguments] --tracer コマンド実行時にトレースを行なう. --back-trace-limit n バックトレース表示をバックトレースの頭から n, 後ろ - からnだけ行なう. デフォルトは16 + からnだけ行なう. デフォルトは16 --irb_debug n irbのデバッグデバッグレベルをnに設定する(利用しな い方が無難でしょう). -v, --version irbのバージョンを表示する diff --git a/lib/logger.rb b/lib/logger.rb index 3319b3092e..6092959399 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -139,7 +139,7 @@ require 'monitor' # 4. With severity. # # logger.add(Logger::FATAL) { 'Fatal error!' } -# +# # The block form allows you to create potentially complex log messages, # but to delay their evaluation until and unless the message is # logged. For example, if we have the following: @@ -209,7 +209,7 @@ class Logger end # not used after 1.2.7. just for compat. class ShiftingError < Error # :nodoc: - end + end # Logging severity. module Severity diff --git a/lib/singleton.rb b/lib/singleton.rb index b634b849f7..be1f7ff6ca 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -14,11 +14,11 @@ require 'thread' # This ensures that only one instance of Klass can be created. # # a,b = Klass.instance, Klass.instance -# -# a == b +# +# a == b # # => true # -# Klass.new +# Klass.new # # => NoMethodError - new is private ... # # The instance is created at upon the first call of Klass.instance(). @@ -28,11 +28,11 @@ require 'thread' # # ... # end # -# ObjectSpace.each_object(OtherKlass){} +# ObjectSpace.each_object(OtherKlass){} # # => 0 # # OtherKlass.instance -# ObjectSpace.each_object(OtherKlass){} +# ObjectSpace.each_object(OtherKlass){} # # => 1 # # @@ -52,19 +52,19 @@ require 'thread' # # * Overriding Klass._load(str) to call Klass.instance(). # -# * Overriding Klass#clone and Klass#dup to raise TypeErrors to prevent +# * Overriding Klass#clone and Klass#dup to raise TypeErrors to prevent # cloning or duping. # # == Singleton and Marshal # # By default Singleton's #_dump(depth) returns the empty string. Marshalling by -# default will strip state information, e.g. instance variables and taint -# state, from the instance. Classes using Singleton can provide custom -# _load(str) and _dump(depth) methods to retain some of the previous state of +# default will strip state information, e.g. instance variables and taint +# state, from the instance. Classes using Singleton can provide custom +# _load(str) and _dump(depth) methods to retain some of the previous state of # the instance. # # require 'singleton' -# +# # class Example # include Singleton # attr_accessor :keep, :strip @@ -72,20 +72,20 @@ require 'thread' # # this strips the @strip information from the instance # Marshal.dump(@keep, depth) # end -# +# # def self._load(str) # instance.keep = Marshal.load(str) # instance # end # end -# +# # a = Example.instance # a.keep = "keep this" # a.strip = "get rid of this" # a.taint -# +# # stored_state = Marshal.dump(a) -# +# # a.keep = nil # a.strip = nil # b = Marshal.load(stored_state) diff --git a/lib/xmlrpc/README.rdoc b/lib/xmlrpc/README.rdoc index 221d675219..2faed28cb9 100644 --- a/lib/xmlrpc/README.rdoc +++ b/lib/xmlrpc/README.rdoc @@ -59,7 +59,7 @@ use the client and implement a server. * REXML (REXMLStreamParser) * xml-scan (XMLScanStreamParser) * Fastest parser is Expat's XMLStreamParser! - + * General * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers * Marshalling Ruby objects to Hashs and reconstruct them later from a Hash @@ -70,7 +70,7 @@ use the client and implement a server. === Client require "xmlrpc/client" - + # Make an object to represent the XML-RPC server. server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") @@ -86,7 +86,7 @@ use the client and implement a server. There are two possible ways, of handling a fault-structure: -==== by catching a XMLRPC::FaultException exception +==== by catching a XMLRPC::FaultException exception require "xmlrpc/client" @@ -107,7 +107,7 @@ There are two possible ways, of handling a fault-structure: puts e.faultCode puts e.faultString end - + ==== by calling "call2" which returns a boolean require "xmlrpc/client" @@ -128,7 +128,7 @@ There are two possible ways, of handling a fault-structure: puts result.faultCode puts result.faultString end - + === Client using Proxy You can create a +Proxy+ object onto which you can call methods. This way it @@ -137,7 +137,7 @@ looks nicer. Both forms, _call_ and _call2_ are supported through _proxy_ and given to each XML-RPC call using that Proxy. require "xmlrpc/client" - + # Make an object to represent the XML-RPC server. server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") @@ -167,7 +167,7 @@ can be mixed: s.add_handler("sample.sumAndDifference") do |a,b| { "sum" => a + b, "difference" => a - b } end - + s.serve ==== Java-like (handler classes) @@ -181,8 +181,8 @@ can be mixed: { "sum" => a + b, "difference" => a - b } end end - - # NOTE: Security Hole (read below)!!! + + # NOTE: Security Hole (read below)!!! s.add_handler("sample", MyHandler.new) s.serve @@ -195,17 +195,17 @@ To return a fault-structure you have to raise an FaultException e.g.: From Brian Candler: - Above code sample has an extremely nasty security hole, in that you can now call - any method of 'MyHandler' remotely, including methods inherited from Object - and Kernel! For example, in the client code, you can use - - puts server.call("sample.send","`","ls") - - (backtick being the method name for running system processes). Needless to - say, 'ls' can be replaced with something else. + Above code sample has an extremely nasty security hole, in that you can now call + any method of 'MyHandler' remotely, including methods inherited from Object + and Kernel! For example, in the client code, you can use - The version which binds proc objects (or the version presented below in the next section) - doesn't have this problem, but people may be tempted to use the second version because it's + puts server.call("sample.send","`","ls") + + (backtick being the method name for running system processes). Needless to + say, 'ls' can be replaced with something else. + + The version which binds proc objects (or the version presented below in the next section) + doesn't have this problem, but people may be tempted to use the second version because it's so nice and 'Rubyesque'. I think it needs a big red disclaimer. @@ -225,7 +225,7 @@ A solution is to undef insecure methods or to use (({XMLRPC::iPIMethods})) as sh # ... -This adds only public instance methods explicitly declared in class MyHandler +This adds only public instance methods explicitly declared in class MyHandler (and not those inherited from any other class). ==== With interface declarations @@ -271,7 +271,7 @@ XML parser, then you have to call the set_parser method of XMLRPC::BasicServer or by editing xmlrpc/config.rb. Client Example: - + # ... server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php") server.set_parser(XMLRPC::XMLParser::XMLParser.new) @@ -283,7 +283,7 @@ Server Example: s = XMLRPC::CGIServer.new s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new) # ... - + or: # ...