* string.c (rb_str_match2): add warning to "~string".
[ruby-list:37751] * lib/net/ftp.rb (Net::FTP::open): takes block. suggested by Gavin Sinclair in [ruby-core:01237]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3f39e3e2a0
commit
fe4de8b4b8
@ -1,3 +1,11 @@
|
|||||||
|
Sat Jul 19 22:25:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_match2): add warning to "~string".
|
||||||
|
[ruby-list:37751]
|
||||||
|
|
||||||
|
* lib/net/ftp.rb (Net::FTP::open): takes block. suggested by Gavin
|
||||||
|
Sinclair in [ruby-core:01237].
|
||||||
|
|
||||||
Sat Jul 19 19:03:24 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
|
Sat Jul 19 19:03:24 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
|
||||||
|
|
||||||
* wince/stdlib.c: add bsearch().
|
* wince/stdlib.c: add bsearch().
|
||||||
|
@ -87,8 +87,20 @@ module Net
|
|||||||
#
|
#
|
||||||
# A synonym for +FTP.new+, but with a mandatory host parameter.
|
# A synonym for +FTP.new+, but with a mandatory host parameter.
|
||||||
#
|
#
|
||||||
|
# If a block is given, it is passed the +FTP+ object, which will be closed
|
||||||
|
# when the block finishes, or when an exception is raised.
|
||||||
|
#
|
||||||
def FTP.open(host, user = nil, passwd = nil, acct = nil)
|
def FTP.open(host, user = nil, passwd = nil, acct = nil)
|
||||||
new(host, user, passwd, acct)
|
if block_given?
|
||||||
|
ftp = new(host, user, passwd, acct)
|
||||||
|
begin
|
||||||
|
yield ftp
|
||||||
|
ensure
|
||||||
|
ftp.close
|
||||||
|
end
|
||||||
|
else
|
||||||
|
new(host, user, passwd, acct)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
3
string.c
3
string.c
@ -1063,6 +1063,9 @@ rb_str_match2(str)
|
|||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
|
#if RUBY_VERSION_CODE < 181
|
||||||
|
rb_warn("~string will be obsolete; use explicit regexp");
|
||||||
|
#endif
|
||||||
return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str)));
|
return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user