git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2004-01-07 11:31:21 +00:00
Родитель c24349e32d
Коммит 6abca35457
4 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -66,7 +66,7 @@ module Kernel
# If the first argument respond to `open' method,
# the method is called with the rest arguments.
#
# If the first argument is a string and begins with xxx://,
# 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.
#
@ -79,7 +79,7 @@ module Kernel
def open(name, *rest, &block)
if name.respond_to?(:open)
name.open(*rest, &block)
elsif name.respond_to?("to_str") &&
elsif name.respond_to?(:to_str) &&
%r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ name &&
(uri = URI.parse(name)).respond_to?(:open)
uri.open(*rest, &block)
@ -250,7 +250,7 @@ module OpenURI
end
end
# returns an Array which consits status code and message.
# returns an Array which consists status code and message.
attr_accessor :status
# returns a URI which is base of relative URIs in the data.
@ -449,14 +449,14 @@ module URI
# But http_proxy and HTTP_PROXY is treated specially under CGI environment.
# It's because HTTP_PROXY may be set by Proxy: header.
# So HTTP_PROXY is not used.
# http_proxy is not used too if the variable is case insentitive.
# http_proxy is not used too if the variable is case insensitive.
# CGI_HTTP_PROXY can be used instead.
def find_proxy
name = self.scheme.downcase + '_proxy'
proxy_uri = nil
if name == 'http_proxy' && ENV.include?('REQUEST_METHOD') # CGI?
# HTTP_PROXY conflicts with *_proxy for proxy settings and
# HTTP_* for header informatin in CGI.
# HTTP_* for header information in CGI.
# So it should be careful to use it.
pairs = ENV.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
case pairs.length
@ -465,12 +465,12 @@ module URI
when 1
k, v = pairs.shift
if k == 'http_proxy' && ENV[k.upcase] == nil
# http_proxy is safe to use becase ENV is case sensitive.
# http_proxy is safe to use because ENV is case sensitive.
proxy_uri = ENV[name]
else
proxy_uri = nil
end
else # http_proxy is safe to use becase ENV is case sensitive.
else # http_proxy is safe to use because ENV is case sensitive.
proxy_uri = ENV[name]
end
if !proxy_uri

Просмотреть файл

@ -51,8 +51,8 @@ PP#pp to print the object.
outputs ((|obj|)) to ((|out|)) in pretty printed format of
((|width|)) columns in width.
If ((|out|)) is ommitted, (({$>})) is assumed.
If ((|width|)) is ommitted, 79 is assumed.
If ((|out|)) is omitted, (({$>})) is assumed.
If ((|width|)) is omitted, 79 is assumed.
PP.pp returns ((|out|)).
@ -269,7 +269,7 @@ class PP < PrettyPrint
def pretty_print_inspect
if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect
raise "pretty_print is not overriden."
raise "pretty_print is not overridden."
end
PP.singleline_pp(self, '')
end

Просмотреть файл

@ -7,14 +7,14 @@ It finds line breaks and nice indentations for grouped structure.
By default, the class assumes that primitive elements are strings and
each byte in the strings have single column in width.
But it can be used for other situasions
But it can be used for other situations
by giving suitable arguments for some methods:
newline object and space generation block for (({PrettyPrint.new})),
optional width argument for (({PrettyPrint#text})),
(({PrettyPrint#breakable})), etc.
There are several candidates to use them:
text formatting using proportional fonts,
multibyte characters which has columns diffrent to number of bytes,
multibyte characters which has columns different to number of bytes,
non-string formatting, etc.
== class methods

Просмотреть файл

@ -13,7 +13,7 @@
#
# === Specialized interface
#
# This library provides methods dedicated to special puposes:
# This library provides methods dedicated to special purposes:
# * RFC 2822, RFC 2616 and XML Schema.
# * They makes usual life easier.
#
@ -353,7 +353,7 @@ class Time
# If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
#
# +fractional_seconds+ specifies a number of digits of fractional seconds.
# Its default value os 0.
# Its default value is 0.
#
def xmlschema(fraction_digits=0)
sprintf('%d-%02d-%02dT%02d:%02d:%02d',