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