summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-14 15:18:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-14 15:18:53 +0000
commitf3d95cce97237eff6ef8248e29e0c40062c72d44 (patch)
treec97a328c74e2ad48882c56d3174f1425ba73b7bd /lib
parent83453ab1caa08ea053627f28ca5b9d1ee72a7920 (diff)
downloadruby-f3d95cce97237eff6ef8248e29e0c40062c72d44.tar.gz
trailing spaces removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.rb12
-rw-r--r--lib/pp.rb54
-rw-r--r--lib/prettyprint.rb14
-rw-r--r--lib/resolv.rb40
-rw-r--r--lib/time.rb38
-rw-r--r--lib/tsort.rb20
6 files changed, 89 insertions, 89 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 238d759d5f..c68aee6e97 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -542,7 +542,7 @@ module OpenURI
# :proxy => true
# :proxy => false
# :proxy => nil
- #
+ #
# If :proxy option is specified, the value should be String, URI,
# boolean or nil.
# When String or URI is given, it is treated as proxy URI.
@@ -556,7 +556,7 @@ module OpenURI
# Synopsis:
# :proxy_http_basic_authentication => ["http://proxy.foo.com:8000/", "proxy-user", "proxy-password"]
# :proxy_http_basic_authentication => [URI.parse("http://proxy.foo.com:8000/"), "proxy-user", "proxy-password"]
- #
+ #
# If :proxy option is specified, the value should be an Array with 3 elements.
# It should contain a proxy URI, a proxy user name and a proxy password.
# The proxy URI should be a String, an URI or nil.
@@ -564,7 +564,7 @@ module OpenURI
#
# If nil is given for the proxy URI, this option is just ignored.
#
- # If :proxy and :proxy_http_basic_authentication is specified,
+ # If :proxy and :proxy_http_basic_authentication is specified,
# ArgumentError is raised.
#
# [:http_basic_authentication]
@@ -579,14 +579,14 @@ module OpenURI
# [:content_length_proc]
# Synopsis:
# :content_length_proc => lambda {|content_length| ... }
- #
+ #
# 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.
- #
+ #
# 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.
diff --git a/lib/pp.rb b/lib/pp.rb
index ec896b3ce5..41f51b0046 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,10 +1,10 @@
# == Pretty-printer for Ruby objects.
-#
+#
# = Which seems better?
-#
+#
# non-pretty-printed output by #p is:
# #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
-#
+#
# pretty-printed output by #pp is:
# #<PP:0x81fedf0
# @buffer=[],
@@ -22,17 +22,17 @@
# @newline="\n",
# @output=#<IO:0x8114ee4>,
# @output_width=2>
-#
+#
# I like the latter. If you do too, this library is for you.
-#
+#
# = Usage
-#
+#
# pp(obj)
#
# output +obj+ to +$>+ in pretty printed format.
-#
+#
# It returns +nil+.
-#
+#
# = Output Customization
# To define your customized pretty printing function for your classes,
# redefine a method #pretty_print(+pp+) in the class.
@@ -67,10 +67,10 @@ end
class PP < PrettyPrint
# Outputs +obj+ to +out+ in pretty printed format of
# +width+ columns in width.
- #
+ #
# If +out+ is omitted, +$>+ is assumed.
# If +width+ is omitted, 79 is assumed.
- #
+ #
# PP.pp returns +out+.
def PP.pp(obj, out=$>, width=79)
q = PP.new(out, width)
@@ -82,7 +82,7 @@ class PP < PrettyPrint
# Outputs +obj+ to +out+ like PP.pp but with no indent and
# newline.
- #
+ #
# PP.singleline_pp returns +out+.
def PP.singleline_pp(obj, out=$>)
q = SingleLine.new(out)
@@ -138,12 +138,12 @@ class PP < PrettyPrint
# Adds +obj+ to the pretty printing buffer
# using Object#pretty_print or Object#pretty_print_cycle.
- #
+ #
# Object#pretty_print_cycle is used when +obj+ is already
# printed, a.k.a the object reference chain has a cycle.
def pp(obj)
id = obj.object_id
-
+
if check_inspect_key(id)
group {obj.pretty_print_cycle self}
return
@@ -158,7 +158,7 @@ class PP < PrettyPrint
end
# A convenience method which is same as follows:
- #
+ #
# group(1, '#<' + obj.class.name, '>') { ... }
def object_group(obj, &block) # :yield:
group(1, '#<' + obj.class.name, '>', &block)
@@ -185,7 +185,7 @@ class PP < PrettyPrint
end
# A convenience method which is same as follows:
- #
+ #
# text ','
# breakable
def comma_breakable
@@ -195,23 +195,23 @@ class PP < PrettyPrint
# Adds a separated list.
# The list is separated by comma with breakable space, by default.
- #
+ #
# #seplist iterates the +list+ using +iter_method+.
# It yields each object to the block given for #seplist.
# The procedure +separator_proc+ is called between each yields.
- #
+ #
# If the iteration is zero times, +separator_proc+ is not called at all.
- #
+ #
# If +separator_proc+ is nil or not given,
# +lambda { comma_breakable }+ is used.
# If +iter_method+ is not given, :each is used.
- #
+ #
# For example, following 3 code fragments has similar effect.
- #
+ #
# q.seplist([1,2,3]) {|v| xxx v }
- #
+ #
# q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }
- #
+ #
# xxx 1
# q.comma_breakable
# xxx 2
@@ -275,11 +275,11 @@ class PP < PrettyPrint
# A default pretty printing method for general objects.
# It calls #pretty_print_instance_variables to list instance variables.
- #
+ #
# If +self+ has a customized (redefined) #inspect method,
# the result of self.inspect is used but it obviously has no
# line break hints.
- #
+ #
# This module provides predefined #pretty_print methods for some of
# the most commonly used built-in classes for convenience.
def pretty_print(q)
@@ -302,7 +302,7 @@ class PP < PrettyPrint
end
# Returns a sorted array of instance variable names.
- #
+ #
# This method should return an array of names of instance variables as symbols or strings as:
# +[:@a, :@b]+.
def pretty_print_instance_variables
@@ -311,7 +311,7 @@ class PP < PrettyPrint
# Is #inspect implementation using #pretty_print.
# If you implement #pretty_print, it can be used as follows.
- #
+ #
# alias inspect pretty_print_inspect
#
# However, doing this requires that every class that #inspect is called on
@@ -629,7 +629,7 @@ if __FILE__ == $0
result = PP.pp(a, '')
assert_equal("#{a.inspect}\n", result)
end
-
+
def test_to_s_without_iv
a = Object.new
def a.to_s() "aaa" end
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb
index 315c422e9e..48f2ebf1e4 100644
--- a/lib/prettyprint.rb
+++ b/lib/prettyprint.rb
@@ -2,7 +2,7 @@
# This class implements a pretty printing algorithm. 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 situations by giving suitable arguments for some methods:
@@ -18,28 +18,28 @@
# == Bugs
# * Box based formatting?
# * Other (better) model/algorithm?
-#
+#
# == References
# Christian Lindig, Strictly Pretty, March 2000,
# http://www.st.cs.uni-sb.de/~lindig/papers/#pretty
-#
+#
# Philip Wadler, A prettier printer, March 1998,
# http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier
-#
+#
# == Author
# Tanaka Akira <akr@m17n.org>
-#
+#
class PrettyPrint
# This is a convenience method which is same as follows:
- #
+ #
# begin
# q = PrettyPrint.new(output, maxwidth, newline, &genspace)
# ...
# q.flush
# output
# end
- #
+ #
def PrettyPrint.format(output='', maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n})
q = PrettyPrint.new(output, maxwidth, newline, &genspace)
yield q
diff --git a/lib/resolv.rb b/lib/resolv.rb
index d1494b46c9..fc3c78215b 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -13,24 +13,24 @@ end
# interpreter.
#
# See also resolv-replace.rb to replace the libc resolver with # Resolv.
-#
+#
# Resolv can look up various DNS resources using the DNS module directly.
-#
+#
# Examples:
-#
+#
# p Resolv.getaddress "www.ruby-lang.org"
# p Resolv.getname "210.251.121.214"
-#
+#
# Resolv::DNS.open do |dns|
# ress = dns.getresources "www.ruby-lang.org", Resolv::DNS::Resource::IN::A
# p ress.map { |r| r.address }
# ress = dns.getresources "ruby-lang.org", Resolv::DNS::Resource::IN::MX
# p ress.map { |r| [r.exchange.to_s, r.preference] }
# end
-#
-#
+#
+#
# == Bugs
-#
+#
# * NIS is not supported.
# * /etc/nsswitch.conf is not supported.
@@ -38,14 +38,14 @@ class Resolv
##
# Looks up the first IP address for +name+.
-
+
def self.getaddress(name)
DefaultResolver.getaddress(name)
end
##
# Looks up all IP address for +name+.
-
+
def self.getaddresses(name)
DefaultResolver.getaddresses(name)
end
@@ -87,7 +87,7 @@ class Resolv
##
# Looks up the first IP address for +name+.
-
+
def getaddress(name)
each_address(name) {|address| return address}
raise ResolvError.new("no address for #{name}")
@@ -95,7 +95,7 @@ class Resolv
##
# Looks up all IP address for +name+.
-
+
def getaddresses(name)
ret = []
each_address(name) {|address| ret << address}
@@ -309,7 +309,7 @@ class Resolv
# Creates a new DNS resolver.
#
# +config_info+ can be:
- #
+ #
# nil:: Uses /etc/resolv.conf.
# String:: Path to a file using /etc/resolv.conf's format.
# Hash:: Must contain :nameserver, :search and :ndots keys.
@@ -457,7 +457,7 @@ class Resolv
##
# Looks up all +typeclass+ DNS resources for +name+. See #getresource for
# argument details.
-
+
def getresources(name, typeclass)
ret = []
each_resource(name, typeclass) {|resource| ret << resource}
@@ -467,7 +467,7 @@ class Resolv
##
# Iterates over all +typeclass+ DNS resources for +name+. See
# #getresource for argument details.
-
+
def each_resource(name, typeclass, &proc)
lazy_initialize
requester = make_requester
@@ -569,7 +569,7 @@ class Resolv
h = (RequestID[[host, port]] ||= {})
begin
id = rangerand(0x0000..0xffff)
- end while h[id]
+ end while h[id]
h[id] = true
}
id
@@ -1037,7 +1037,7 @@ class Resolv
# A representation of a DNS name.
class Name
-
+
##
# Creates a new DNS name from +arg+. +arg+ can be:
#
@@ -1460,11 +1460,11 @@ class Resolv
class Query
def encode_rdata(msg) # :nodoc:
- raise EncodeError.new("#{self.class} is query.")
+ raise EncodeError.new("#{self.class} is query.")
end
def self.decode_rdata(msg) # :nodoc:
- raise DecodeError.new("#{self.class} is query.")
+ raise DecodeError.new("#{self.class} is query.")
end
end
@@ -1939,7 +1939,7 @@ class Resolv
def initialize(address)
@address = IPv6.create(address)
end
-
+
##
# The Resolv::IPv6 address for this AAAA.
@@ -1956,7 +1956,7 @@ class Resolv
##
# SRV resource record defined in RFC 2782
- #
+ #
# These records identify the hostname and port that a service is
# available at.
diff --git a/lib/time.rb b/lib/time.rb
index 96f3945320..85c715b80b 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -1,37 +1,37 @@
#
# == Introduction
-#
+#
# This library extends the Time class:
# * conversion between date string and time object.
# * date-time defined by RFC 2822
# * HTTP-date defined by RFC 2616
# * dateTime defined by XML Schema Part 2: Datatypes (ISO 8601)
# * various formats handled by Date._parse (string to time only)
-#
+#
# == Design Issues
-#
+#
# === Specialized interface
-#
+#
# This library provides methods dedicated to special purposes:
# * RFC 2822, RFC 2616 and XML Schema.
# * They makes usual life easier.
-#
+#
# === Doesn't depend on strftime
-#
+#
# This library doesn't use +strftime+. Especially #rfc2822 doesn't depend
# on +strftime+ because:
-#
+#
# * %a and %b are locale sensitive
-#
+#
# Since they are locale sensitive, they may be replaced to
# invalid weekday/month name in some locales.
# Since ruby-1.6 doesn't invoke setlocale by default,
# the problem doesn't arise until some external library invokes setlocale.
# Ruby/GTK is the example of such library.
-#
+#
# * %z is not portable
-#
+#
# %z is required to generate zone in date-time of RFC 2822
# but it is not portable.
#
@@ -61,9 +61,9 @@ class Time
'PST' => -8, 'PDT' => -7,
# Following definition of military zones is original one.
# See RFC 1123 and RFC 2822 for the error in RFC 822.
- 'A' => +1, 'B' => +2, 'C' => +3, 'D' => +4, 'E' => +5, 'F' => +6,
+ 'A' => +1, 'B' => +2, 'C' => +3, 'D' => +4, 'E' => +5, 'F' => +6,
'G' => +7, 'H' => +8, 'I' => +9, 'K' => +10, 'L' => +11, 'M' => +12,
- 'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6,
+ 'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6,
'T' => -7, 'U' => -8, 'V' => -9, 'W' => -10, 'X' => -11, 'Y' => -12,
}
def zone_offset(zone, year=self.now.year)
@@ -436,8 +436,8 @@ class Time
#
# Returns a string which represents the time as rfc1123-date of HTTP-date
- # defined by RFC 2616:
- #
+ # defined by RFC 2616:
+ #
# day-of-week, DD month-name CCYY hh:mm:ss GMT
#
# Note that the result is always UTC (GMT).
@@ -768,21 +768,21 @@ if __FILE__ == $0
def test_rfc2822_leap_second
t = Time.utc(1998,12,31,23,59,59)
assert_equal(t, Time.rfc2822("Thu, 31 Dec 1998 23:59:59 UTC"))
- assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 -0000"));t.localtime
+ assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 -0000"));t.localtime
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 08:59:59 +0900"))
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 00:59:59 +0100"))
assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 +0000"))
- assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:59 -0100"));t.utc
+ assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:59 -0100"));t.utc
t += 1
assert_equal(t, Time.rfc2822("Thu, 31 Dec 1998 23:59:60 UTC"))
- assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 -0000"));t.localtime
+ assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 -0000"));t.localtime
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 08:59:60 +0900"))
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 00:59:60 +0100"))
assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 +0000"))
- assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:60 -0100"));t.utc
+ assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:60 -0100"));t.utc
t += 1 if t.sec == 60
assert_equal(t, Time.rfc2822("Thu, 1 Jan 1999 00:00:00 UTC"))
- assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 00:00:00 -0000"));t.localtime
+ assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 00:00:00 -0000"));t.localtime
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 09:00:00 +0900"))
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 01:00:00 +0100"))
assert_equal(t, Time.rfc2822("Fri, 1 Jan 1999 00:00:00 +0000"))
diff --git a/lib/tsort.rb b/lib/tsort.rb
index a014e7f6c2..9fc4feadcd 100644
--- a/lib/tsort.rb
+++ b/lib/tsort.rb
@@ -32,7 +32,7 @@
# array using the user-supplied block.
#
# require 'tsort'
-#
+#
# class Hash
# include TSort
# alias tsort_each_node each_key
@@ -40,10 +40,10 @@
# fetch(node).each(&block)
# end
# end
-#
+#
# {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
# #=> [3, 2, 1, 4]
-#
+#
# {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
# #=> [[4], [2, 3], [1]]
#
@@ -52,19 +52,19 @@
# A very simple `make' like tool can be implemented as follows:
#
# require 'tsort'
-#
+#
# class Make
# def initialize
# @dep = {}
# @dep.default = []
# end
-#
+#
# def rule(outputs, inputs=[], &block)
# triple = [outputs, inputs, block]
# outputs.each {|f| @dep[f] = [triple]}
# @dep[triple] = inputs
# end
-#
+#
# def build(target)
# each_strongly_connected_component_from(target) {|ns|
# if ns.length != 1
@@ -88,18 +88,18 @@
# end
# }
# end
-#
+#
# def tsort_each_child(node, &block)
# @dep[node].each(&block)
# end
# include TSort
# end
-#
+#
# def command(arg)
# print arg, "\n"
# system arg
# end
-#
+#
# m = Make.new
# m.rule(%w[t1]) { command 'date > t1' }
# m.rule(%w[t2]) { command 'date > t2' }
@@ -189,7 +189,7 @@ module TSort
end
#
- # Iterates over strongly connected component in the subgraph reachable from
+ # Iterates over strongly connected component in the subgraph reachable from
# _node_.
#
# Return value is unspecified.