mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* document updates - [ruby-core:04296], [ruby-core:04301],
[ruby-core:04302], [ruby-core:04307] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
83b531e3ea
commit
2ef0c6a109
6 changed files with 204 additions and 46 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Jan 24 15:44:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* document updates - [ruby-core:04296], [ruby-core:04301],
|
||||||
|
[ruby-core:04302], [ruby-core:04307]
|
||||||
|
|
||||||
Sun Jan 23 12:41:16 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
Sun Jan 23 12:41:16 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||||
|
|
||||||
* lib/soap/wsdlDriver.rb: from 1.5.3-ruby1.8.2, operation which has
|
* lib/soap/wsdlDriver.rb: from 1.5.3-ruby1.8.2, operation which has
|
||||||
|
|
9
eval.c
9
eval.c
|
@ -8264,15 +8264,14 @@ static VALUE method_arity _((VALUE));
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* prc.arity -> fixnum
|
* prc.arity -> fixnum
|
||||||
*
|
*
|
||||||
* Returns the number of arguments required by the block. If the block
|
* Returns the number of arguments that would not be ignored. If the block
|
||||||
* is declared to take no arguments, returns 0. If the block is known
|
* is declared to take no arguments, returns 0. If the block is known
|
||||||
* to take exactly n arguments, returns n. If the block has optional
|
* to take exactly n arguments, returns n. If the block has optional
|
||||||
* arguments, return -n-1, where n is the number of mandatory
|
* arguments, return -n-1, where n is the number of mandatory
|
||||||
* arguments. A <code>proc</code> with no argument declarations
|
* arguments. A <code>proc</code> with no argument declarations
|
||||||
* returns -1, as it can accept (and ignore) an arbitrary number of
|
* is the same a block declaring <code>||</code> as its arguments.
|
||||||
* parameters.
|
|
||||||
*
|
*
|
||||||
* Proc.new {}.arity #=> -1
|
* Proc.new {}.arity #=> 0
|
||||||
* Proc.new {||}.arity #=> 0
|
* Proc.new {||}.arity #=> 0
|
||||||
* Proc.new {|a|}.arity #=> 1
|
* Proc.new {|a|}.arity #=> 1
|
||||||
* Proc.new {|a,b|}.arity #=> 2
|
* Proc.new {|a,b|}.arity #=> 2
|
||||||
|
|
|
@ -174,7 +174,7 @@ module RDoc
|
||||||
# prepare to parse a C file
|
# prepare to parse a C file
|
||||||
def initialize(top_level, file_name, body, options, stats)
|
def initialize(top_level, file_name, body, options, stats)
|
||||||
@known_classes = KNOWN_CLASSES.dup
|
@known_classes = KNOWN_CLASSES.dup
|
||||||
@body = handle_ifdefs_in(body)
|
@body = handle_tab_width(handle_ifdefs_in(body))
|
||||||
@options = options
|
@options = options
|
||||||
@stats = stats
|
@stats = stats
|
||||||
@top_level = top_level
|
@top_level = top_level
|
||||||
|
@ -187,6 +187,7 @@ module RDoc
|
||||||
def scan
|
def scan
|
||||||
remove_commented_out_lines
|
remove_commented_out_lines
|
||||||
do_classes
|
do_classes
|
||||||
|
do_constants
|
||||||
do_methods
|
do_methods
|
||||||
do_includes
|
do_includes
|
||||||
do_aliases
|
do_aliases
|
||||||
|
@ -240,7 +241,7 @@ module RDoc
|
||||||
if @body =~ %r{((?>/\*.*?\*/\s+))
|
if @body =~ %r{((?>/\*.*?\*/\s+))
|
||||||
(static\s+)?void\s+Init_#{class_name}\s*\(\)}xmi
|
(static\s+)?void\s+Init_#{class_name}\s*\(\)}xmi
|
||||||
comment = $1
|
comment = $1
|
||||||
elsif @body =~ %r{Document-(class|module):\s#{class_name}.*?\n((?>.*?\*/))}m
|
elsif @body =~ %r{Document-(class|module):\s#{class_name}\s*?\n((?>.*?\*/))}m
|
||||||
comment = $2
|
comment = $2
|
||||||
end
|
end
|
||||||
class_meth.comment = mangle_comment(comment) if comment
|
class_meth.comment = mangle_comment(comment) if comment
|
||||||
|
@ -249,13 +250,13 @@ module RDoc
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
def do_classes
|
def do_classes
|
||||||
@body.scan(/(\w+)\s* = \s*rb_define_module\(\s*"(\w+)"\s*\)/mx) do
|
@body.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
|
||||||
|var_name, class_name|
|
|var_name, class_name|
|
||||||
handle_class_module(var_name, "module", class_name, nil, nil)
|
handle_class_module(var_name, "module", class_name, nil, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# The '.' lets us handle SWIG-generated files
|
# The '.' lets us handle SWIG-generated files
|
||||||
@body.scan(/([\w\.]+)\s* = \s*rb_define_class
|
@body.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
|
||||||
\(
|
\(
|
||||||
\s*"(\w+)",
|
\s*"(\w+)",
|
||||||
\s*(\w+)\s*
|
\s*(\w+)\s*
|
||||||
|
@ -265,7 +266,7 @@ module RDoc
|
||||||
handle_class_module(var_name, "class", class_name, parent, nil)
|
handle_class_module(var_name, "class", class_name, parent, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
@body.scan(/(\w+)\s*=\s*boot_defclass\(\s*"(\w+?)",\s*(\w+?)\)/) do
|
@body.scan(/(\w+)\s*=\s*boot_defclass\s*\(\s*"(\w+?)",\s*(\w+?)\s*\)/) do
|
||||||
|var_name, class_name, parent|
|
|var_name, class_name, parent|
|
||||||
parent = nil if parent == "0"
|
parent = nil if parent == "0"
|
||||||
handle_class_module(var_name, "class", class_name, parent, nil)
|
handle_class_module(var_name, "class", class_name, parent, nil)
|
||||||
|
@ -281,17 +282,39 @@ module RDoc
|
||||||
handle_class_module(var_name, "module", class_name, nil, in_module)
|
handle_class_module(var_name, "module", class_name, nil, in_module)
|
||||||
end
|
end
|
||||||
|
|
||||||
@body.scan(/([\w\.]+)\s* = \s*rb_define_class_under
|
@body.scan(/([\w\.]+)\s* = \s*rb_define_class_under\s*
|
||||||
\(
|
\(
|
||||||
\s*(\w+),
|
\s*(\w+),
|
||||||
\s*"(\w+)",
|
\s*"(\w+)",
|
||||||
\s*(\w+)\s*
|
\s*(\w+)\s*
|
||||||
\)/mx) do
|
\s*\)/mx) do
|
||||||
|
|
||||||
|var_name, in_module, class_name, parent|
|
|var_name, in_module, class_name, parent|
|
||||||
handle_class_module(var_name, "class", class_name, parent, in_module)
|
handle_class_module(var_name, "class", class_name, parent, in_module)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
def do_constants
|
||||||
|
@body.scan(%r{\Wrb_define_
|
||||||
|
(
|
||||||
|
variable |
|
||||||
|
readonly_variable |
|
||||||
|
const |
|
||||||
|
global_const |
|
||||||
|
)
|
||||||
|
\s*\(
|
||||||
|
(?:\s*(\w+),)?
|
||||||
|
\s*"(\w+)",
|
||||||
|
\s*(.*?)\s*\)\s*;
|
||||||
|
}xm) do
|
||||||
|
|
||||||
|
|type, var_name, const_name, definition|
|
||||||
|
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
||||||
|
handle_constants(type, var_name, const_name, definition)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
@ -305,7 +328,7 @@ module RDoc
|
||||||
module_function |
|
module_function |
|
||||||
private_method
|
private_method
|
||||||
)
|
)
|
||||||
\(\s*([\w\.]+),
|
\s*\(\s*([\w\.]+),
|
||||||
\s*"([^"]+)",
|
\s*"([^"]+)",
|
||||||
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
||||||
\s*(-?\w+)\s*\)
|
\s*(-?\w+)\s*\)
|
||||||
|
@ -325,7 +348,21 @@ module RDoc
|
||||||
meth_body, param_count, source_file)
|
meth_body, param_count, source_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
@body.scan(%r{rb_define_global_function\(
|
@body.scan(%r{rb_define_attr\(
|
||||||
|
\s*([\w\.]+),
|
||||||
|
\s*"([^"]+)",
|
||||||
|
\s*(\d+),
|
||||||
|
\s*(\d+)\s*\);
|
||||||
|
}xm) do #"
|
||||||
|
|var_name, attr_name, attr_reader, attr_writer|
|
||||||
|
|
||||||
|
#var_name = "rb_cObject" if var_name == "rb_mKernel"
|
||||||
|
handle_attr(var_name, attr_name,
|
||||||
|
attr_reader.to_i != 0,
|
||||||
|
attr_writer.to_i != 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
@body.scan(%r{rb_define_global_function\s*\(
|
||||||
\s*"([^"]+)",
|
\s*"([^"]+)",
|
||||||
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
||||||
\s*(-?\w+)\s*\)
|
\s*(-?\w+)\s*\)
|
||||||
|
@ -336,7 +373,7 @@ module RDoc
|
||||||
meth_body, param_count, source_file)
|
meth_body, param_count, source_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
@body.scan(/define_filetest_function\(
|
@body.scan(/define_filetest_function\s*\(
|
||||||
\s*"([^"]+)",
|
\s*"([^"]+)",
|
||||||
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
||||||
\s*(-?\w+)\s*\)/xm) do #"
|
\s*(-?\w+)\s*\)/xm) do #"
|
||||||
|
@ -350,7 +387,7 @@ module RDoc
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
def do_aliases
|
def do_aliases
|
||||||
@body.scan(%r{rb_define_alias\(\s*(\w+),\s*"([^"]+)",\s*"([^"]+)"\s*\)}m) do
|
@body.scan(%r{rb_define_alias\s*\(\s*(\w+),\s*"([^"]+)",\s*"([^"]+)"\s*\)}m) do
|
||||||
|var_name, new_name, old_name|
|
|var_name, new_name, old_name|
|
||||||
@stats.num_methods += 1
|
@stats.num_methods += 1
|
||||||
class_name = @known_classes[var_name] || var_name
|
class_name = @known_classes[var_name] || var_name
|
||||||
|
@ -362,6 +399,83 @@ module RDoc
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
|
def handle_constants(type, var_name, const_name, definition)
|
||||||
|
#@stats.num_constants += 1
|
||||||
|
class_name = @known_classes[var_name]
|
||||||
|
|
||||||
|
return unless class_name
|
||||||
|
|
||||||
|
class_obj = find_class(var_name, class_name)
|
||||||
|
|
||||||
|
unless class_obj
|
||||||
|
$stderr.puts("Enclosing class/module '#{const_name}' for not known")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
comment = find_const_comment(type, const_name)
|
||||||
|
|
||||||
|
con = Constant.new(const_name, definition, mangle_comment(comment))
|
||||||
|
class_obj.add_constant(con)
|
||||||
|
end
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
def find_const_comment(type, const_name)
|
||||||
|
if @body =~ %r{((?>/\*.*?\*/\s+))
|
||||||
|
rb_define_#{type}\((?:\s*(\w+),)?\s*"#{const_name}"\s*,.*?\)\s*;}xmi
|
||||||
|
$1
|
||||||
|
elsif @body =~ %r{Document-(?:const|global|variable):\s#{const_name}\s*?\n((?>.*?\*/))}m
|
||||||
|
$1
|
||||||
|
else
|
||||||
|
''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
def handle_attr(var_name, attr_name, reader, writer)
|
||||||
|
rw = ''
|
||||||
|
if reader
|
||||||
|
#@stats.num_methods += 1
|
||||||
|
rw << 'R'
|
||||||
|
end
|
||||||
|
if writer
|
||||||
|
#@stats.num_methods += 1
|
||||||
|
rw << 'W'
|
||||||
|
end
|
||||||
|
|
||||||
|
class_name = @known_classes[var_name]
|
||||||
|
|
||||||
|
return unless class_name
|
||||||
|
|
||||||
|
class_obj = find_class(var_name, class_name)
|
||||||
|
|
||||||
|
if class_obj
|
||||||
|
comment = find_attr_comment(attr_name)
|
||||||
|
unless comment.empty?
|
||||||
|
comment = mangle_comment(comment)
|
||||||
|
end
|
||||||
|
att = Attr.new('', attr_name, rw, comment)
|
||||||
|
class_obj.add_attribute(att)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
def find_attr_comment(attr_name)
|
||||||
|
if @body =~ %r{((?>/\*.*?\*/\s+))
|
||||||
|
rb_define_attr\((?:\s*(\w+),)?\s*"#{attr_name}"\s*,.*?\)\s*;}xmi
|
||||||
|
$1
|
||||||
|
elsif @body =~ %r{Document-attr:\s#{attr_name}\s*?\n((?>.*?\*/))}m
|
||||||
|
$1
|
||||||
|
else
|
||||||
|
''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
def handle_method(type, var_name, meth_name,
|
def handle_method(type, var_name, meth_name,
|
||||||
meth_body, param_count, source_file = nil)
|
meth_body, param_count, source_file = nil)
|
||||||
@stats.num_methods += 1
|
@stats.num_methods += 1
|
||||||
|
@ -469,12 +583,10 @@ module RDoc
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
def find_override_comment(meth_name)
|
def find_override_comment(meth_name)
|
||||||
comment = nil
|
|
||||||
name = Regexp.escape(meth_name)
|
name = Regexp.escape(meth_name)
|
||||||
if @body =~ %r{Document-method:\s#{name}.*?\n((?>.*?\*/))}m
|
if @body =~ %r{Document-method:\s#{name}\s*?\n((?>.*?\*/))}m
|
||||||
comment = $1
|
$1
|
||||||
end
|
end
|
||||||
comment
|
|
||||||
end
|
end
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
@ -482,7 +594,7 @@ module RDoc
|
||||||
# Look for includes of the form
|
# Look for includes of the form
|
||||||
# rb_include_module(rb_cArray, rb_mEnumerable);
|
# rb_include_module(rb_cArray, rb_mEnumerable);
|
||||||
def do_includes
|
def do_includes
|
||||||
@body.scan(/rb_include_module\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
|
@body.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
|
||||||
if cls = @classes[c]
|
if cls = @classes[c]
|
||||||
m = KNOWN_CLASSES[m] || m
|
m = KNOWN_CLASSES[m] || m
|
||||||
cls.add_include(Include.new(m, ""))
|
cls.add_include(Include.new(m, ""))
|
||||||
|
@ -512,6 +624,18 @@ module RDoc
|
||||||
@classes[raw_name]
|
@classes[raw_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_tab_width(body)
|
||||||
|
if /\t/ =~ body
|
||||||
|
tab_width = Options.instance.tab_width
|
||||||
|
body.split(/\n/).map do |line|
|
||||||
|
1 while line.gsub!(/\t+/) { ' ' * (tab_width*$&.length - $`.length % tab_width)} && $~ #`
|
||||||
|
line
|
||||||
|
end .join("\n")
|
||||||
|
else
|
||||||
|
body
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Remove #ifdefs that would otherwise confuse us
|
# Remove #ifdefs that would otherwise confuse us
|
||||||
|
|
||||||
def handle_ifdefs_in(body)
|
def handle_ifdefs_in(body)
|
||||||
|
|
|
@ -1883,6 +1883,7 @@ module RDoc
|
||||||
name_t = get_tk
|
name_t = get_tk
|
||||||
back_tk = skip_tkspace
|
back_tk = skip_tkspace
|
||||||
meth = nil
|
meth = nil
|
||||||
|
added_container = false
|
||||||
|
|
||||||
dot = get_tk
|
dot = get_tk
|
||||||
if dot.kind_of?(TkDOT) or dot.kind_of?(TkCOLON2)
|
if dot.kind_of?(TkDOT) or dot.kind_of?(TkCOLON2)
|
||||||
|
@ -1897,8 +1898,21 @@ module RDoc
|
||||||
prev_container = container
|
prev_container = container
|
||||||
container = container.find_module_named(name_t.name)
|
container = container.find_module_named(name_t.name)
|
||||||
if !container
|
if !container
|
||||||
warn("Couldn't find #{name_t.name}. Assuming it's a module")
|
added_container = true
|
||||||
container = prev_container.add_module(NormalModule, name_t.name)
|
obj = name_t.name.split("::").inject(Object) do |state, item|
|
||||||
|
state.const_get(item)
|
||||||
|
end rescue nil
|
||||||
|
|
||||||
|
type = obj.class == Class ? NormalClass : NormalModule
|
||||||
|
if not [Class, Module].include?(obj.class)
|
||||||
|
warn("Couldn't find #{name_t.name}. Assuming it's a module")
|
||||||
|
end
|
||||||
|
|
||||||
|
if type == NormalClass then
|
||||||
|
container = prev_container.add_class(type, name_t.name, obj.superclass.name)
|
||||||
|
else
|
||||||
|
container = prev_container.add_module(type, name_t.name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# warn("Unexpected token '#{name_t2.inspect}'")
|
# warn("Unexpected token '#{name_t2.inspect}'")
|
||||||
|
@ -1940,7 +1954,9 @@ module RDoc
|
||||||
parse_method_parameters(meth)
|
parse_method_parameters(meth)
|
||||||
|
|
||||||
if meth.document_self
|
if meth.document_self
|
||||||
container.add_method(meth)
|
container.add_method(meth)
|
||||||
|
elsif added_container
|
||||||
|
container.document_self = false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Having now read the method parameters and documentation modifiers, we
|
# Having now read the method parameters and documentation modifiers, we
|
||||||
|
|
|
@ -30,8 +30,12 @@ module RDoc
|
||||||
|
|
||||||
def scan
|
def scan
|
||||||
# @body.gsub(/^(\s\n)+/, '')
|
# @body.gsub(/^(\s\n)+/, '')
|
||||||
@top_level.comment = @body
|
@top_level.comment = remove_private_comments(@body)
|
||||||
@top_level
|
@top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_private_comments(comment)
|
||||||
|
comment.gsub(/^--.*?^\+\+/m, '').sub(/^--.*/m, '')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,38 +1,39 @@
|
||||||
|
# = timeout.rb
|
||||||
#
|
#
|
||||||
# timeout.rb -- execution timeout
|
# execution timeout
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
# = Synopsis
|
||||||
# Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
|
||||||
#
|
|
||||||
#= SYNOPSIS
|
|
||||||
#
|
#
|
||||||
# require 'timeout'
|
# require 'timeout'
|
||||||
# status = timeout(5) {
|
# status = Timeout::timeout(5) {
|
||||||
# # something may take time
|
# # Something that should be interrupted if it takes too much time...
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
#= DESCRIPTION
|
# = Description
|
||||||
#
|
#
|
||||||
# timeout executes the block. If the block execution terminates successfully
|
# A way of performing a potentially long-running operation in a thread, and terminating
|
||||||
# before timeout, it returns true. If not, it terminates the execution and
|
# it's execution if it hasn't finished by a fixed amount of time.
|
||||||
# raise TimeoutError exception.
|
|
||||||
#
|
#
|
||||||
#== Parameters
|
# Previous versions of timeout didn't provide use a module for namespace. This version
|
||||||
|
# provides both Timeout.timeout, and a backwards-compatible #timeout.
|
||||||
#
|
#
|
||||||
# : timout
|
# = Copyright
|
||||||
#
|
#
|
||||||
# The time in seconds to wait for block termination.
|
# Copyright:: (C) 2000 Network Applied Communication Laboratory, Inc.
|
||||||
#
|
# Copyright:: (C) 2000 Information-technology Promotion Agency, Japan
|
||||||
# : [exception]
|
|
||||||
#
|
|
||||||
# The exception class to be raised on timeout.
|
|
||||||
#
|
|
||||||
#=end
|
|
||||||
|
|
||||||
module Timeout
|
module Timeout
|
||||||
|
# Raised by Timeout#timeout when the block times out.
|
||||||
class Error<Interrupt
|
class Error<Interrupt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Executes the method's block. If the block execution terminates before +sec+
|
||||||
|
# seconds has passed, it returns true. If not, it terminates the execution
|
||||||
|
# and raises +exception+ (which defaults to Timeout::Error).
|
||||||
|
#
|
||||||
|
# Note that this is both a method of module Timeout, so you can 'include Timeout'
|
||||||
|
# into your classes so they have a #timeout method, as well as a module method,
|
||||||
|
# so you can call it directly as Timeout.timeout().
|
||||||
def timeout(sec, exception=Error)
|
def timeout(sec, exception=Error)
|
||||||
return yield if sec == nil or sec.zero?
|
return yield if sec == nil or sec.zero?
|
||||||
begin
|
begin
|
||||||
|
@ -47,13 +48,22 @@ module Timeout
|
||||||
y.kill if y and y.alive?
|
y.kill if y and y.alive?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :timeout
|
module_function :timeout
|
||||||
end
|
end
|
||||||
|
|
||||||
# compatible
|
# Identical to:
|
||||||
|
#
|
||||||
|
# Timeout::timeout(n, e, &block).
|
||||||
|
#
|
||||||
|
# Defined for backwards compatibility with earlier versions of timeout.rb, see
|
||||||
|
# Timeout#timeout.
|
||||||
def timeout(n, e=Timeout::Error, &block)
|
def timeout(n, e=Timeout::Error, &block)
|
||||||
Timeout::timeout(n, e, &block)
|
Timeout::timeout(n, e, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Another name for Timeout::Error, defined for backwards compatibility with
|
||||||
|
# earlier versions of timeout.rb.
|
||||||
TimeoutError = Timeout::Error
|
TimeoutError = Timeout::Error
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue