summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi.rb2
-rw-r--r--lib/csv.rb8
-rw-r--r--lib/delegate.rb3
-rw-r--r--lib/generator.rb4
-rw-r--r--lib/net/http.rb8
-rw-r--r--lib/net/https.rb2
-rw-r--r--lib/net/imap.rb2
-rw-r--r--lib/net/pop.rb4
-rw-r--r--lib/net/smtp.rb6
-rw-r--r--lib/open-uri.rb2
-rw-r--r--lib/ostruct.rb2
-rw-r--r--lib/rational.rb4
-rw-r--r--lib/resolv.rb12
-rw-r--r--lib/singleton.rb20
-rw-r--r--lib/tempfile.rb2
-rw-r--r--lib/wsdl/operation.rb2
-rw-r--r--lib/xmlrpc/parser.rb2
17 files changed, 44 insertions, 41 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 77f7e2880a..e4acfd3138 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -30,7 +30,7 @@
# See http://www.w3.org/CGI/ for more information on the CGI
# protocol.
-raise "Please, use ruby1.5.4 or later." if RUBY_VERSION < "1.5.4"
+raise "Please, use ruby 1.5.4 or later." if RUBY_VERSION < "1.5.4"
require 'English'
diff --git a/lib/csv.rb b/lib/csv.rb
index 205c3385c4..09c638ceaf 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -557,7 +557,7 @@ class CSV
private
def initialize(dev)
- raise RuntimeError.new('do not instanciate this class directly')
+ raise RuntimeError.new('do not instantiate this class directly')
end
def get_row(row)
@@ -709,7 +709,7 @@ class CSV
private
def initialize(dev)
- raise RuntimeError.new('do not instanciate this class directly')
+ raise RuntimeError.new('do not instantiate this class directly')
end
def terminate
@@ -801,7 +801,7 @@ class CSV
# end
# end
#
- class StreamBuf # pure virtual. (do not instanciate it directly)
+ class StreamBuf # pure virtual. (do not instantiate it directly)
# get a char or a partial string from the stream.
# idx: index of a string to specify a start point of a string to get.
@@ -893,7 +893,7 @@ class CSV
return idx_is_eos?(0)
end
- # WARN: Do not instanciate this class directly. Define your own class
+ # WARN: Do not instantiate this class directly. Define your own class
# which derives this class and define 'read' instance method.
def initialize
@buf_list = []
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 6ceaa67d29..cccaea8570 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -111,6 +111,9 @@ def DelegateClass(superclass)
def __getobj__
@_dc_obj
end
+ def __setobj__(obj)
+ @_dc_obj = obj
+ end
return klass;
end
diff --git a/lib/generator.rb b/lib/generator.rb
index 805e7a2630..a010559b60 100644
--- a/lib/generator.rb
+++ b/lib/generator.rb
@@ -125,7 +125,7 @@ class Generator
# Returns the element at the current position and moves forward.
def next()
if end?
- raise EOFError, "no more element is supplied"
+ raise EOFError, "no more elements available"
end
if @cont_next = callcc { |c| c }
@@ -140,7 +140,7 @@ class Generator
# Returns the element at the current position.
def current()
if @queue.empty?
- raise EOFError, "no more element is supplied"
+ raise EOFError, "no more elements available"
end
@queue.first
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 7abde21670..0b7e20633b 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -121,7 +121,7 @@ module Net # :nodoc:
#
# def fetch( uri_str, limit = 10 )
# # You should choose better exception.
- # raise ArgumentError, 'http redirect too deep' if limit == 0
+ # raise ArgumentError, 'HTTP redirect too deep' if limit == 0
#
# response = Net::HTTP.get_response(URI.parse(uri_str))
# case response
@@ -480,7 +480,7 @@ module Net # :nodoc:
# Finishes HTTP session and closes TCP connection.
# Raises IOError if not started.
def finish
- raise IOError, 'HTTP session not started yet' unless started?
+ raise IOError, 'HTTP session not yet started' unless started?
do_finish
end
@@ -2058,11 +2058,11 @@ e @header.each_key(&block)
end
def stream_check
- raise IOError, 'try to read body out of block' if @socket.closed?
+ raise IOError, 'attempt to read body out of block' if @socket.closed?
end
def procdest(dest, block)
- raise ArgumentError, 'both of arg and block are given for HTTP method' \
+ raise ArgumentError, 'both arg and block given for HTTP method' \
if dest and block
if block
ReadAdapter.new(block)
diff --git a/lib/net/https.rb b/lib/net/https.rb
index 4200be3d62..a22084dc99 100644
--- a/lib/net/https.rb
+++ b/lib/net/https.rb
@@ -123,7 +123,7 @@ module Net
# a Net::HTTP object raises IOError.
def use_ssl=(flag)
flag = (flag ? true : false)
- raise IOError, "use_ssl value changed but session already started" \
+ raise IOError, "use_ssl value changed, but session already started" \
if started? and @use_ssl != flag
if flag and not @ssl_context
@ssl_context = OpenSSL::SSL::SSLContext.new
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 85bef3c391..641d50e41f 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -859,7 +859,7 @@ module Net # :nodoc:
# firewall.
# Errno::ETIMEDOUT:: connection timed out (possibly due to packets
# being dropped by an intervening firewall).
- # Errno::NETUNREACH:: there is no route to that network.
+ # Errno::ENETUNREACH:: there is no route to that network.
# SocketError:: hostname not known or other socket error.
# Net::IMAP::ByeResponseError:: we connected to the host, but they
# immediately said goodbye to us.
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index 4a27bac0b8..21b58aa503 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -293,7 +293,7 @@ module Net
# This method must not be called while POP3 session is opened.
# This method raises POPAuthenticationError if authentication fails.
def auth_only(account, password)
- raise IOError, 'opening already opened POP session' if started?
+ raise IOError, 'opening previously opened POP session' if started?
start(account, password) {
;
}
@@ -449,7 +449,7 @@ module Net
# Finishes a POP3 session and closes TCP connection.
def finish
- raise IOError, 'POP session not started yet' unless started?
+ raise IOError, 'POP session not yet started' unless started?
do_finish
end
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 123d31d205..9a5e84620f 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -373,7 +373,7 @@ module Net # :nodoc:
# Finishes the SMTP session and closes TCP connection.
# Raises IOError if not started.
def finish
- raise IOError, 'not started yet' unless started?
+ raise IOError, 'not yet started' unless started?
do_finish
end
@@ -474,7 +474,7 @@ module Net # :nodoc:
def send0( from_addr, to_addrs )
raise IOError, 'closed session' unless @socket
- raise ArgumentError, 'mail destination does not given' if to_addrs.empty?
+ raise ArgumentError, 'mail destination not given' if to_addrs.empty?
if $SAFE > 0
raise SecurityError, 'tainted from_addr' if from_addr.tainted?
to_addrs.each do |to|
@@ -501,7 +501,7 @@ module Net # :nodoc:
private
def check_auth_args( user, secret, authtype )
- raise ArgumentError, 'both of user and secret are required'\
+ raise ArgumentError, 'both user and secret are required'\
unless user and secret
auth_method = "auth_#{authtype || 'cram_md5'}"
raise ArgumentError, "wrong auth type #{authtype}"\
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 84acdb9984..75ce63a288 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -501,7 +501,7 @@ module URI
if proxy_uri
proxy_uri = URI.parse(proxy_uri)
unless URI::HTTP === proxy_uri
- raise "Non-http proxy URI: #{proxy_uri}"
+ raise "Non-HTTP proxy URI: #{proxy_uri}"
end
name = 'no_proxy'
if no_proxy = ENV[name] || ENV[name.upcase]
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index b0bb775263..464fff0cdf 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -63,7 +63,7 @@ class OpenStruct
len = args.length
if mname =~ /=$/
if len != 1
- raise ArgumentError, "wrong # of arguments (#{len} for 1)", caller(1)
+ raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
if self.frozen?
raise TypeError, "can't modify frozen #{self.class}", caller(1)
diff --git a/lib/rational.rb b/lib/rational.rb
index 38af7b8a81..2019363ac6 100644
--- a/lib/rational.rb
+++ b/lib/rational.rb
@@ -48,7 +48,7 @@ class Rational < Numeric
@RCS_ID='-$Id: rational.rb,v 1.7 1999/08/24 12:49:28 keiju Exp keiju $-'
def Rational.reduce(num, den = 1)
- raise ZeroDivisionError, "denominator is 0" if den == 0
+ raise ZeroDivisionError, "denominator is zero" if den == 0
if den < 0
num = -num
@@ -135,7 +135,7 @@ class Rational < Numeric
den = @denominator * a.numerator
Rational(num, den)
elsif a.kind_of?(Integer)
- raise ZeroDivisionError, "divided by 0" if a == 0
+ raise ZeroDivisionError, "division by zero" if a == 0
self / Rational.new!(a, 1)
elsif a.kind_of?(Float)
Float(self) / a
diff --git a/lib/resolv.rb b/lib/resolv.rb
index edc17c2f19..ad52882582 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1157,9 +1157,9 @@ class Resolv
@limit = @index + len
d = yield(len)
if @index < @limit
- raise DecodeError.new("junk exist")
+ raise DecodeError.new("junk exists")
elsif @limit < @index
- raise DecodeError.new("limit exceed")
+ raise DecodeError.new("limit exceeded")
end
@limit = save_limit
return d
@@ -1185,7 +1185,7 @@ class Resolv
raise StandardError.new("unsupported template: '#{byte.chr}' in '#{template}'")
end
}
- raise DecodeError.new("limit exceed") if @limit < @index + len
+ raise DecodeError.new("limit exceeded") if @limit < @index + len
arr = @data.unpack("@#{@index}#{template}")
@index += len
return arr
@@ -1193,7 +1193,7 @@ class Resolv
def get_string
len = @data[@index]
- raise DecodeError.new("limit exceed") if @limit < @index + 1 + len
+ raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len
d = @data[@index + 1, len]
@index += 1 + len
return d
@@ -1554,7 +1554,7 @@ class Resolv
raise ArgumentError.new("IPv4 address with invalid value: " + arg)
end
else
- raise ArgumentError.new("cannot interprete as IPv4 address: #{arg.inspect}")
+ raise ArgumentError.new("cannot interpret as IPv4 address: #{arg.inspect}")
end
end
@@ -1662,7 +1662,7 @@ class Resolv
end
return IPv6.new(address)
else
- raise ArgumentError.new("cannot interprete as IPv6 address: #{arg.inspect}")
+ raise ArgumentError.new("cannot interpret as IPv6 address: #{arg.inspect}")
end
end
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 2954bfa153..18fda0bc58 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -13,7 +13,7 @@
# a == b # => true
# a.new # NoMethodError - new is private ...
#
-# * ``The instance'' is created at instanciation time, in other
+# * ``The instance'' is created at instantiation time, in other
# words the first call of Klass.instance(), thus
#
# class OtherKlass
@@ -44,11 +44,11 @@
#
# * Klass._load(str) - calling Klass.instance()
#
-# * Klass._instanciate?() - returning ``the instance'' or
+# * Klass._instantiate?() - returning ``the instance'' or
# nil. This hook method puts a second (or nth) thread calling
# Klass.instance() on a waiting loop. The return value
# signifies the successful completion or premature termination
-# of the first, or more generally, current "instanciation thread".
+# of the first, or more generally, current "instantiation thread".
#
#
# The instance method of Singleton are
@@ -103,7 +103,7 @@ class << Singleton
@__instance__ = nil # failed instance creation
end
end
- elsif _instanciate?()
+ elsif _instantiate?()
Thread.critical = false
else
@__instance__ = false
@@ -144,7 +144,7 @@ class << Singleton
end
# waiting-loop hook
- def _instanciate?()
+ def _instantiate?()
while false.equal?(@__instance__)
Thread.critical = false
sleep(0.08) # timeout
@@ -209,7 +209,7 @@ end
-puts "\nThreaded example with exception and customized #_instanciate?() hook"; p
+puts "\nThreaded example with exception and customized #_instantiate?() hook"; p
Thread.abort_on_exception = false
class Ups < SomeSingletonClass
@@ -220,7 +220,7 @@ class Ups < SomeSingletonClass
end
class << Ups
- def _instanciate?
+ def _instantiate?
@enter.push Thread.current[:i]
while false.equal?(@__instance__)
Thread.critical = false
@@ -247,7 +247,7 @@ class << Ups
end
end
- def instanciate_all
+ def instantiate_all
@enter = []
@leave = []
1.upto(9) {|i|
@@ -270,7 +270,7 @@ class << Ups
end
-Ups.instanciate_all
+Ups.instantiate_all
# results in message like
# Before there were 0 Ups instance(s)
# boom - thread #6 failed to create instance
@@ -293,7 +293,7 @@ def Yup.new
end
end
end
-Yup.instanciate_all
+Yup.instantiate_all
puts "\n\n","Customized marshalling"
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index a78b9469db..38a72e1255 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -9,7 +9,7 @@ require 'tmpdir'
# A class for managing temporary files. This library is written to be
# thread safe.
-class Tempfile < SimpleDelegator
+class Tempfile < DelegateClass(File)
MAX_TRY = 10
@@cleanlist = []
diff --git a/lib/wsdl/operation.rb b/lib/wsdl/operation.rb
index be28446d34..228dc85b05 100644
--- a/lib/wsdl/operation.rb
+++ b/lib/wsdl/operation.rb
@@ -119,7 +119,7 @@ private
return parts.dup
end
if parts.length != result.length
- raise RuntimeError.new("Incomplete prarmeterOrder list.")
+ raise RuntimeError.new("Incomplete parameter order list.")
end
result
end
diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb
index 357618261e..da214ba1ce 100644
--- a/lib/xmlrpc/parser.rb
+++ b/lib/xmlrpc/parser.rb
@@ -467,7 +467,7 @@ module XMLRPC
else
# is a normal return value
raise "Missing return value!" if parser.params.size == 0
- raise "To many return values. Only one allowed!" if parser.params.size > 1
+ raise "Too many return values. Only one allowed!" if parser.params.size > 1
[true, parser.params[0]]
end
end