зеркало из https://github.com/github/ruby.git
* ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patch
by Luke Gruber. [#5203] * ext/pty/lib/expect.rb: ditto * lib/mathn.rb: ditto * lib/net/http.rb: ditto * lib/open-uri.rb: ditto * lib/ostruct.rb: ditto * lib/tempfile.rb: ditto * lib/thread.rb: ditto * lib/weakref.rb: ditto * sample/webrick/httpproxy.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
18e342e80d
Коммит
ca96541149
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Sat Aug 27 07:22:07 2011 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patch
|
||||
by Luke Gruber. [#5203]
|
||||
* ext/pty/lib/expect.rb: ditto
|
||||
* lib/mathn.rb: ditto
|
||||
* lib/net/http.rb: ditto
|
||||
* lib/open-uri.rb: ditto
|
||||
* lib/ostruct.rb: ditto
|
||||
* lib/tempfile.rb: ditto
|
||||
* lib/thread.rb: ditto
|
||||
* lib/weakref.rb: ditto
|
||||
* sample/webrick/httpproxy.rb: ditto
|
||||
|
||||
Sat Aug 27 04:03:18 2011 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* iseq.c (iseq_data_to_ary): fix type of variable
|
||||
|
|
|
@ -386,7 +386,7 @@ class Pathname
|
|||
# pn.children(false)
|
||||
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
|
||||
#
|
||||
# Note that the result never contain the entries <tt>.</tt> and <tt>..</tt> in
|
||||
# Note that the results never contain the entries <tt>.</tt> and <tt>..</tt> in
|
||||
# the directory because they are not children.
|
||||
#
|
||||
# This method has existed since 1.8.1.
|
||||
|
@ -490,7 +490,7 @@ class Pathname # * Find *
|
|||
# manner. It yields a Pathname for each file under "this" directory.
|
||||
#
|
||||
# Since it is implemented by <tt>find.rb</tt>, <tt>Find.prune</tt> can be used
|
||||
# to control the traverse.
|
||||
# to control the traversal.
|
||||
#
|
||||
# If +self+ is <tt>.</tt>, yielded pathnames begin with a filename in the
|
||||
# current directory, not <tt>./</tt>.
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
$expect_verbose = false
|
||||
|
||||
class IO
|
||||
# Reads ios until pattern matches or the timeout is over. It returns
|
||||
# an array with the read buffer, followed by the matches. If a block is given,
|
||||
# the result is yielded to the block and returns nil. The optional timeout parameter defines,
|
||||
# in seconds, the total time to wait for pattern. If it is over of eof is found, it
|
||||
# returns/yields nil. However, the buffer in a timeout session is kept for the next expect call.
|
||||
# The default timeout is 9999999 seconds.
|
||||
# Reads from the IO until pattern +pat+ matches or the +timeout+ is over.
|
||||
# It returns an array with the read buffer, followed by the matches.
|
||||
# If a block is given, the result is yielded to the block and returns nil.
|
||||
#
|
||||
# The optional timeout parameter defines, in seconds, the total time to wait
|
||||
# for the pattern. If the timeout expires or eof is found, nil is returned
|
||||
# or yielded. However, the buffer in a timeout session is kept for the next
|
||||
# expect call. The default timeout is 9999999 seconds.
|
||||
def expect(pat,timeout=9999999)
|
||||
buf = ''
|
||||
case pat
|
||||
|
|
16
lib/mathn.rb
16
lib/mathn.rb
|
@ -28,7 +28,7 @@
|
|||
# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
|
||||
#
|
||||
#
|
||||
# When you require 'mathn' the libraries for Prime, CMath, Matrix and Vector
|
||||
# When you require 'mathn', the libraries for Prime, CMath, Matrix and Vector
|
||||
# are also loaded.
|
||||
#
|
||||
# == Copyright
|
||||
|
@ -53,8 +53,8 @@ unless defined?(Math.exp!)
|
|||
end
|
||||
|
||||
##
|
||||
# When mathn is required Fixnum's division and exponentiation are enhanced to
|
||||
# return more precise values in mathematical formulas.
|
||||
# When mathn is required, Fixnum's division and exponentiation are enhanced to
|
||||
# return more precise values from mathematical expressions.
|
||||
#
|
||||
# 2/3*3 # => 0
|
||||
# require 'mathn'
|
||||
|
@ -87,7 +87,7 @@ end
|
|||
|
||||
##
|
||||
# When mathn is required Bignum's division and exponentiation are enhanced to
|
||||
# return more precise values in mathematical formulas.
|
||||
# return more precise values from mathematical expressions.
|
||||
|
||||
class Bignum
|
||||
remove_method :/
|
||||
|
@ -115,7 +115,7 @@ class Bignum
|
|||
end
|
||||
|
||||
##
|
||||
# When mathn is required Rational changes to simplfy the usage of Rational
|
||||
# When mathn is required Rational is changed to simplify the use of Rational
|
||||
# operations.
|
||||
#
|
||||
# Normal behaviour:
|
||||
|
@ -198,14 +198,14 @@ class Rational
|
|||
end
|
||||
|
||||
##
|
||||
# When mathn is requried the Math module changes as follows:
|
||||
# When mathn is required, the Math module changes as follows:
|
||||
#
|
||||
# Standard Math module behaviour:
|
||||
# Math.sqrt(4/9) # => 0.0
|
||||
# Math.sqrt(4.0/9.0) # => 0.666666666666667
|
||||
# Math.sqrt(- 4/9) # => Errno::EDOM: Numerical argument out of domain - sqrt
|
||||
#
|
||||
# After require 'mathn' this is changed to:
|
||||
# After require 'mathn', this is changed to:
|
||||
#
|
||||
# require 'mathn'
|
||||
# Math.sqrt(4/9) # => 2/3
|
||||
|
@ -305,7 +305,7 @@ module Math
|
|||
end
|
||||
|
||||
##
|
||||
# When mathn is required Float is changed to handle Complex numbers.
|
||||
# When mathn is required, Float is changed to handle Complex numbers.
|
||||
|
||||
class Float
|
||||
alias power! **
|
||||
|
|
|
@ -308,7 +308,7 @@ module Net #:nodoc:
|
|||
# Here is HTTP response class hierarchy. All classes are defined in Net
|
||||
# module and are subclasses of Net::HTTPResponse.
|
||||
#
|
||||
# HTTPUnknownResponse:: For unhandled HTTP extenensions
|
||||
# HTTPUnknownResponse:: For unhandled HTTP extensions
|
||||
# HTTPInformation:: 1xx
|
||||
# HTTPContinue:: 100
|
||||
# HTTPSwitchProtocol:: 101
|
||||
|
@ -514,7 +514,7 @@ module Net #:nodoc:
|
|||
# Creates a new Net::HTTP object, then additionally opens the TCP
|
||||
# connection and HTTP session.
|
||||
#
|
||||
# Argments are following:
|
||||
# Arguments are the following:
|
||||
# _address_ :: hostname or IP address of the server
|
||||
# _port_ :: port of the server
|
||||
# _p_addr_ :: address of proxy
|
||||
|
|
|
@ -9,21 +9,21 @@ module Kernel
|
|||
alias open_uri_original_open open # :nodoc:
|
||||
end
|
||||
|
||||
# makes possible to open various resources including URIs.
|
||||
# If the first argument respond to `open' method,
|
||||
# the method is called with the rest arguments.
|
||||
# Allows the opening of various resources including URIs.
|
||||
#
|
||||
# If the first argument is a string which begins with xxx://,
|
||||
# it is parsed by URI.parse. If the parsed object respond to `open' method,
|
||||
# the method is called with the rest arguments.
|
||||
# If the first argument responds to the 'open' method, 'open' is called on
|
||||
# it with the rest of the arguments.
|
||||
#
|
||||
# Otherwise original open is called.
|
||||
# If the first argument is a string that begins with xxx://, it is parsed by
|
||||
# URI.parse. If the parsed object responds to the 'open' method,
|
||||
# 'open' is called on it with the rest of the arguments.
|
||||
#
|
||||
# Otherwise, the original Kernel#open is called.
|
||||
#
|
||||
# Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and
|
||||
# URI::FTP#open,
|
||||
# Kernel[#.]open can accepts such URIs and strings which begins with
|
||||
# http://, https:// and ftp://.
|
||||
# In these case, the opened file object is extended by OpenURI::Meta.
|
||||
# URI::FTP#open, Kernel[#.]open can accept URIs and strings that begin with
|
||||
# http://, https:// and ftp://. In these cases, the opened file object is
|
||||
# extended by OpenURI::Meta.
|
||||
def open(name, *rest, &block) # :doc:
|
||||
if name.respond_to?(:open)
|
||||
name.open(*rest, &block)
|
||||
|
@ -42,14 +42,14 @@ end
|
|||
#
|
||||
#== Example
|
||||
#
|
||||
# It is possible to open http/https/ftp URL as usual like opening a file:
|
||||
# It is possible to open an http, https or ftp URL as though it were a file:
|
||||
#
|
||||
# open("http://www.ruby-lang.org/") {|f|
|
||||
# f.each_line {|line| p line}
|
||||
# }
|
||||
#
|
||||
# The opened file has several methods for meta information as follows since
|
||||
# it is extended by OpenURI::Meta.
|
||||
# The opened file has several getter methods for its meta-information, as
|
||||
# follows, since it is extended by OpenURI::Meta.
|
||||
#
|
||||
# open("http://www.ruby-lang.org/en") {|f|
|
||||
# f.each_line {|line| p line}
|
||||
|
@ -407,14 +407,14 @@ module OpenURI
|
|||
end
|
||||
end
|
||||
|
||||
# returns an Array which consists status code and message.
|
||||
# returns an Array that consists of status code and message.
|
||||
attr_accessor :status
|
||||
|
||||
# returns a URI which is base of relative URIs in the data.
|
||||
# It may differ from the URI supplied by a user because redirection.
|
||||
# returns a URI that is the base of relative URIs in the data.
|
||||
# It may differ from the URI supplied by a user due to redirection.
|
||||
attr_accessor :base_uri
|
||||
|
||||
# returns a Hash which represents header fields.
|
||||
# returns a Hash that represents header fields.
|
||||
# The Hash keys are downcased for canonicalization.
|
||||
attr_reader :meta
|
||||
|
||||
|
@ -443,7 +443,7 @@ module OpenURI
|
|||
meta_setup_encoding if name == 'content-type'
|
||||
end
|
||||
|
||||
# returns a Time which represents Last-Modified field.
|
||||
# returns a Time that represents the Last-Modified field.
|
||||
def last_modified
|
||||
if v = @meta['last-modified']
|
||||
Time.httpdate(v)
|
||||
|
@ -537,11 +537,10 @@ module OpenURI
|
|||
#
|
||||
# `options' must be a hash.
|
||||
#
|
||||
# Each pairs which key is a string in the hash specify a extra header
|
||||
# field for HTTP.
|
||||
# I.e. it is ignored for FTP without HTTP proxy.
|
||||
# Each option pair with a string key specifies an extra header field for
|
||||
# HTTP. I.e., it is ignored for FTP without HTTP proxy.
|
||||
#
|
||||
# The hash may include other options which key is a symbol:
|
||||
# The hash may include other options, where keys are symbols:
|
||||
#
|
||||
# [:proxy]
|
||||
# Synopsis:
|
||||
|
@ -590,14 +589,13 @@ module OpenURI
|
|||
#
|
||||
# If :content_length_proc option is specified, the option value procedure
|
||||
# is called before actual transfer is started.
|
||||
# It takes one argument which is expected content length in bytes.
|
||||
# It takes one argument, which is expected content length in bytes.
|
||||
#
|
||||
# If two or more transfer is done by HTTP redirection, the procedure
|
||||
# is called only one for a last transfer.
|
||||
#
|
||||
# When expected content length is unknown, the procedure is called with
|
||||
# nil.
|
||||
# It is happen when HTTP response has no Content-Length header.
|
||||
# nil. This happens when the HTTP response has no Content-Length header.
|
||||
#
|
||||
# [:progress_proc]
|
||||
# Synopsis:
|
||||
|
@ -646,7 +644,7 @@ module OpenURI
|
|||
#
|
||||
# :ssl_verify_mode is used to specify openssl verify mode.
|
||||
#
|
||||
# OpenURI::OpenRead#open returns an IO like object if block is not given.
|
||||
# OpenURI::OpenRead#open returns an IO-like object if block is not given.
|
||||
# Otherwise it yields the IO object and return the value of the block.
|
||||
# The IO object is extended with OpenURI::Meta.
|
||||
#
|
||||
|
@ -662,10 +660,10 @@ module OpenURI
|
|||
# Synopsis:
|
||||
# :redirect=>bool
|
||||
#
|
||||
# :redirect=>false is used to disable HTTP redirects at all.
|
||||
# :redirect=>false is used to disable all HTTP redirects.
|
||||
# OpenURI::HTTPRedirect exception raised on redirection.
|
||||
# It is true by default.
|
||||
# The true means redirections between http and ftp is permitted.
|
||||
# The true means redirections between http and ftp are permitted.
|
||||
#
|
||||
def open(*rest, &block)
|
||||
OpenURI.open_uri(self, *rest, &block)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# An OpenStruct is a data structure, similar to a Hash, that allows the
|
||||
# definition of arbitrary attributes with their accompanying values. This is
|
||||
# accomplished by using Ruby's metaporgramming to define methods on the class
|
||||
# accomplished by using Ruby's metaprogramming to define methods on the class
|
||||
# itself.
|
||||
#
|
||||
# == Examples:
|
||||
|
@ -72,8 +72,8 @@
|
|||
# method_missing and define_method.
|
||||
#
|
||||
# This should be a consideration if there is a concern about the performance of
|
||||
# the objects that are created. As there is much more overhead in the setting
|
||||
# of these properties compard to utilizing a Hash or a Struct.
|
||||
# the objects that are created, as there is much more overhead in the setting
|
||||
# of these properties compared to using a Hash or a Struct.
|
||||
#
|
||||
class OpenStruct
|
||||
#
|
||||
|
|
|
@ -39,7 +39,7 @@ require 'thread'
|
|||
# that's it's unnecessary to explicitly delete a Tempfile after use, though
|
||||
# it's good practice to do so: not explicitly deleting unused Tempfiles can
|
||||
# potentially leave behind large amounts of tempfiles on the filesystem
|
||||
# until they're garbage collected. The existance of these temp files can make
|
||||
# until they're garbage collected. The existence of these temp files can make
|
||||
# it harder to determine a new Tempfile filename.
|
||||
#
|
||||
# Therefore, one should always call #unlink or close in an ensure block, like
|
||||
|
|
|
@ -94,7 +94,7 @@ class ConditionVariable
|
|||
# Wakes up all threads waiting for this lock.
|
||||
#
|
||||
def broadcast
|
||||
# TODO: imcomplete
|
||||
# TODO: incomplete
|
||||
waiters0 = nil
|
||||
@waiters_mutex.synchronize do
|
||||
waiters0 = @waiters.dup
|
||||
|
@ -144,7 +144,7 @@ class Queue
|
|||
def initialize
|
||||
@que = []
|
||||
@waiting = []
|
||||
@que.taint # enable tainted comunication
|
||||
@que.taint # enable tainted communication
|
||||
@waiting.taint
|
||||
self.taint
|
||||
@mutex = Mutex.new
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "delegate"
|
||||
require 'thread'
|
||||
|
||||
# Weak Reference class that does allows a referenced object to be
|
||||
# Weak Reference class that allows a referenced object to be
|
||||
# garbage-collected. A WeakRef may be used exactly like the object it
|
||||
# references.
|
||||
#
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
require "webrick"
|
||||
require "webrick/httpproxy"
|
||||
|
||||
# :ProxyContentHandler will be invoked before sending
|
||||
# response to User-Agenge. You can inspect the pair of
|
||||
# request and response messages (or can edit the response
|
||||
# message if necessary).
|
||||
# The :ProxyContentHandler proc will be invoked before sending a response to
|
||||
# the User-Agent. You can inspect the pair of request and response messages
|
||||
# (or edit the response message if necessary).
|
||||
|
||||
pch = Proc.new{|req, res|
|
||||
p [ req.request_line, res.status_line ]
|
||||
|
|
Загрузка…
Ссылка в новой задаче