* 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:
parent
18e342e80d
commit
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>
|
Sat Aug 27 04:03:18 2011 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* iseq.c (iseq_data_to_ary): fix type of variable
|
* iseq.c (iseq_data_to_ary): fix type of variable
|
||||||
|
@ -386,7 +386,7 @@ class Pathname
|
|||||||
# pn.children(false)
|
# pn.children(false)
|
||||||
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
|
# # -> [ 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.
|
# the directory because they are not children.
|
||||||
#
|
#
|
||||||
# This method has existed since 1.8.1.
|
# 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.
|
# 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
|
# 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
|
# If +self+ is <tt>.</tt>, yielded pathnames begin with a filename in the
|
||||||
# current directory, not <tt>./</tt>.
|
# current directory, not <tt>./</tt>.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
$expect_verbose = false
|
$expect_verbose = false
|
||||||
|
|
||||||
class IO
|
class IO
|
||||||
# Reads ios until pattern matches or the timeout is over. It returns
|
# Reads from the IO until pattern +pat+ matches or the +timeout+ is over.
|
||||||
# an array with the read buffer, followed by the matches. If a block is given,
|
# It returns an array with the read buffer, followed by the matches.
|
||||||
# the result is yielded to the block and returns nil. The optional timeout parameter defines,
|
# If a block is given, the result is yielded to the block and returns nil.
|
||||||
# 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 optional timeout parameter defines, in seconds, the total time to wait
|
||||||
# The default timeout is 9999999 seconds.
|
# 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)
|
def expect(pat,timeout=9999999)
|
||||||
buf = ''
|
buf = ''
|
||||||
case pat
|
case pat
|
||||||
|
16
lib/mathn.rb
16
lib/mathn.rb
@ -28,7 +28,7 @@
|
|||||||
# 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
|
# 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.
|
# are also loaded.
|
||||||
#
|
#
|
||||||
# == Copyright
|
# == Copyright
|
||||||
@ -53,8 +53,8 @@ unless defined?(Math.exp!)
|
|||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# When mathn is required Fixnum's division and exponentiation are enhanced to
|
# When mathn is required, Fixnum's division and exponentiation are enhanced to
|
||||||
# return more precise values in mathematical formulas.
|
# return more precise values from mathematical expressions.
|
||||||
#
|
#
|
||||||
# 2/3*3 # => 0
|
# 2/3*3 # => 0
|
||||||
# require 'mathn'
|
# require 'mathn'
|
||||||
@ -87,7 +87,7 @@ end
|
|||||||
|
|
||||||
##
|
##
|
||||||
# When mathn is required Bignum's division and exponentiation are enhanced to
|
# 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
|
class Bignum
|
||||||
remove_method :/
|
remove_method :/
|
||||||
@ -115,7 +115,7 @@ class Bignum
|
|||||||
end
|
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.
|
# operations.
|
||||||
#
|
#
|
||||||
# Normal behaviour:
|
# Normal behaviour:
|
||||||
@ -198,14 +198,14 @@ class Rational
|
|||||||
end
|
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:
|
# Standard Math module behaviour:
|
||||||
# Math.sqrt(4/9) # => 0.0
|
# Math.sqrt(4/9) # => 0.0
|
||||||
# Math.sqrt(4.0/9.0) # => 0.666666666666667
|
# Math.sqrt(4.0/9.0) # => 0.666666666666667
|
||||||
# Math.sqrt(- 4/9) # => Errno::EDOM: Numerical argument out of domain - sqrt
|
# 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'
|
# require 'mathn'
|
||||||
# Math.sqrt(4/9) # => 2/3
|
# Math.sqrt(4/9) # => 2/3
|
||||||
@ -305,7 +305,7 @@ module Math
|
|||||||
end
|
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
|
class Float
|
||||||
alias power! **
|
alias power! **
|
||||||
|
@ -308,7 +308,7 @@ module Net #:nodoc:
|
|||||||
# Here is HTTP response class hierarchy. All classes are defined in Net
|
# Here is HTTP response class hierarchy. All classes are defined in Net
|
||||||
# module and are subclasses of Net::HTTPResponse.
|
# module and are subclasses of Net::HTTPResponse.
|
||||||
#
|
#
|
||||||
# HTTPUnknownResponse:: For unhandled HTTP extenensions
|
# HTTPUnknownResponse:: For unhandled HTTP extensions
|
||||||
# HTTPInformation:: 1xx
|
# HTTPInformation:: 1xx
|
||||||
# HTTPContinue:: 100
|
# HTTPContinue:: 100
|
||||||
# HTTPSwitchProtocol:: 101
|
# HTTPSwitchProtocol:: 101
|
||||||
@ -514,7 +514,7 @@ module Net #:nodoc:
|
|||||||
# Creates a new Net::HTTP object, then additionally opens the TCP
|
# Creates a new Net::HTTP object, then additionally opens the TCP
|
||||||
# connection and HTTP session.
|
# connection and HTTP session.
|
||||||
#
|
#
|
||||||
# Argments are following:
|
# Arguments are the following:
|
||||||
# _address_ :: hostname or IP address of the server
|
# _address_ :: hostname or IP address of the server
|
||||||
# _port_ :: port of the server
|
# _port_ :: port of the server
|
||||||
# _p_addr_ :: address of proxy
|
# _p_addr_ :: address of proxy
|
||||||
|
@ -9,21 +9,21 @@ module Kernel
|
|||||||
alias open_uri_original_open open # :nodoc:
|
alias open_uri_original_open open # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
# makes possible to open various resources including URIs.
|
# Allows the opening of various resources including URIs.
|
||||||
# If the first argument respond to `open' method,
|
|
||||||
# the method is called with the rest arguments.
|
|
||||||
#
|
#
|
||||||
# If the first argument is a string which begins with xxx://,
|
# If the first argument responds to the 'open' method, 'open' is called on
|
||||||
# it is parsed by URI.parse. If the parsed object respond to `open' method,
|
# it with the rest of the arguments.
|
||||||
# the method is called with the rest 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
|
# Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and
|
||||||
# URI::FTP#open,
|
# URI::FTP#open, Kernel[#.]open can accept URIs and strings that begin with
|
||||||
# Kernel[#.]open can accepts such URIs and strings which begins with
|
# http://, https:// and ftp://. In these cases, the opened file object is
|
||||||
# http://, https:// and ftp://.
|
# extended by OpenURI::Meta.
|
||||||
# In these case, the opened file object is extended by OpenURI::Meta.
|
|
||||||
def open(name, *rest, &block) # :doc:
|
def open(name, *rest, &block) # :doc:
|
||||||
if name.respond_to?(:open)
|
if name.respond_to?(:open)
|
||||||
name.open(*rest, &block)
|
name.open(*rest, &block)
|
||||||
@ -42,14 +42,14 @@ end
|
|||||||
#
|
#
|
||||||
#== Example
|
#== 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|
|
# open("http://www.ruby-lang.org/") {|f|
|
||||||
# f.each_line {|line| p line}
|
# f.each_line {|line| p line}
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# The opened file has several methods for meta information as follows since
|
# The opened file has several getter methods for its meta-information, as
|
||||||
# it is extended by OpenURI::Meta.
|
# follows, since it is extended by OpenURI::Meta.
|
||||||
#
|
#
|
||||||
# open("http://www.ruby-lang.org/en") {|f|
|
# open("http://www.ruby-lang.org/en") {|f|
|
||||||
# f.each_line {|line| p line}
|
# f.each_line {|line| p line}
|
||||||
@ -407,14 +407,14 @@ module OpenURI
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# returns an Array which consists status code and message.
|
# returns an Array that consists of status code and message.
|
||||||
attr_accessor :status
|
attr_accessor :status
|
||||||
|
|
||||||
# returns a URI which is base of relative URIs in the data.
|
# returns a URI that is the base of relative URIs in the data.
|
||||||
# It may differ from the URI supplied by a user because redirection.
|
# It may differ from the URI supplied by a user due to redirection.
|
||||||
attr_accessor :base_uri
|
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.
|
# The Hash keys are downcased for canonicalization.
|
||||||
attr_reader :meta
|
attr_reader :meta
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ module OpenURI
|
|||||||
meta_setup_encoding if name == 'content-type'
|
meta_setup_encoding if name == 'content-type'
|
||||||
end
|
end
|
||||||
|
|
||||||
# returns a Time which represents Last-Modified field.
|
# returns a Time that represents the Last-Modified field.
|
||||||
def last_modified
|
def last_modified
|
||||||
if v = @meta['last-modified']
|
if v = @meta['last-modified']
|
||||||
Time.httpdate(v)
|
Time.httpdate(v)
|
||||||
@ -537,11 +537,10 @@ module OpenURI
|
|||||||
#
|
#
|
||||||
# `options' must be a hash.
|
# `options' must be a hash.
|
||||||
#
|
#
|
||||||
# Each pairs which key is a string in the hash specify a extra header
|
# Each option pair with a string key specifies an extra header field for
|
||||||
# field for HTTP.
|
# HTTP. I.e., it is ignored for FTP without HTTP proxy.
|
||||||
# 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]
|
# [:proxy]
|
||||||
# Synopsis:
|
# Synopsis:
|
||||||
@ -590,14 +589,13 @@ module OpenURI
|
|||||||
#
|
#
|
||||||
# If :content_length_proc option is specified, the option value procedure
|
# If :content_length_proc option is specified, the option value procedure
|
||||||
# is called before actual transfer is started.
|
# 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
|
# If two or more transfer is done by HTTP redirection, the procedure
|
||||||
# is called only one for a last transfer.
|
# is called only one for a last transfer.
|
||||||
#
|
#
|
||||||
# When expected content length is unknown, the procedure is called with
|
# When expected content length is unknown, the procedure is called with
|
||||||
# nil.
|
# nil. This happens when the HTTP response has no Content-Length header.
|
||||||
# It is happen when HTTP response has no Content-Length header.
|
|
||||||
#
|
#
|
||||||
# [:progress_proc]
|
# [:progress_proc]
|
||||||
# Synopsis:
|
# Synopsis:
|
||||||
@ -646,7 +644,7 @@ module OpenURI
|
|||||||
#
|
#
|
||||||
# :ssl_verify_mode is used to specify openssl verify mode.
|
# :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.
|
# Otherwise it yields the IO object and return the value of the block.
|
||||||
# The IO object is extended with OpenURI::Meta.
|
# The IO object is extended with OpenURI::Meta.
|
||||||
#
|
#
|
||||||
@ -662,10 +660,10 @@ module OpenURI
|
|||||||
# Synopsis:
|
# Synopsis:
|
||||||
# :redirect=>bool
|
# :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.
|
# OpenURI::HTTPRedirect exception raised on redirection.
|
||||||
# It is true by default.
|
# 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)
|
def open(*rest, &block)
|
||||||
OpenURI.open_uri(self, *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
|
# An OpenStruct is a data structure, similar to a Hash, that allows the
|
||||||
# definition of arbitrary attributes with their accompanying values. This is
|
# 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.
|
# itself.
|
||||||
#
|
#
|
||||||
# == Examples:
|
# == Examples:
|
||||||
@ -72,8 +72,8 @@
|
|||||||
# method_missing and define_method.
|
# method_missing and define_method.
|
||||||
#
|
#
|
||||||
# This should be a consideration if there is a concern about the performance of
|
# 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
|
# 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.
|
# of these properties compared to using a Hash or a Struct.
|
||||||
#
|
#
|
||||||
class OpenStruct
|
class OpenStruct
|
||||||
#
|
#
|
||||||
|
@ -39,7 +39,7 @@ require 'thread'
|
|||||||
# that's it's unnecessary to explicitly delete a Tempfile after use, though
|
# 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
|
# it's good practice to do so: not explicitly deleting unused Tempfiles can
|
||||||
# potentially leave behind large amounts of tempfiles on the filesystem
|
# 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.
|
# it harder to determine a new Tempfile filename.
|
||||||
#
|
#
|
||||||
# Therefore, one should always call #unlink or close in an ensure block, like
|
# 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.
|
# Wakes up all threads waiting for this lock.
|
||||||
#
|
#
|
||||||
def broadcast
|
def broadcast
|
||||||
# TODO: imcomplete
|
# TODO: incomplete
|
||||||
waiters0 = nil
|
waiters0 = nil
|
||||||
@waiters_mutex.synchronize do
|
@waiters_mutex.synchronize do
|
||||||
waiters0 = @waiters.dup
|
waiters0 = @waiters.dup
|
||||||
@ -144,7 +144,7 @@ class Queue
|
|||||||
def initialize
|
def initialize
|
||||||
@que = []
|
@que = []
|
||||||
@waiting = []
|
@waiting = []
|
||||||
@que.taint # enable tainted comunication
|
@que.taint # enable tainted communication
|
||||||
@waiting.taint
|
@waiting.taint
|
||||||
self.taint
|
self.taint
|
||||||
@mutex = Mutex.new
|
@mutex = Mutex.new
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "delegate"
|
require "delegate"
|
||||||
require 'thread'
|
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
|
# garbage-collected. A WeakRef may be used exactly like the object it
|
||||||
# references.
|
# references.
|
||||||
#
|
#
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
require "webrick"
|
require "webrick"
|
||||||
require "webrick/httpproxy"
|
require "webrick/httpproxy"
|
||||||
|
|
||||||
# :ProxyContentHandler will be invoked before sending
|
# The :ProxyContentHandler proc will be invoked before sending a response to
|
||||||
# response to User-Agenge. You can inspect the pair of
|
# the User-Agent. You can inspect the pair of request and response messages
|
||||||
# request and response messages (or can edit the response
|
# (or edit the response message if necessary).
|
||||||
# message if necessary).
|
|
||||||
|
|
||||||
pch = Proc.new{|req, res|
|
pch = Proc.new{|req, res|
|
||||||
p [ req.request_line, res.status_line ]
|
p [ req.request_line, res.status_line ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user