diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-19 04:14:40 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-19 04:14:40 +0000 |
commit | 6e3deb2fa9285fa95377839abff55c1f1058eded (patch) | |
tree | e160e651578422cd854faa01b58f1d5c56f52c2a | |
parent | 58e8cbe1f9e895477c01ad190aa09989395d3998 (diff) | |
download | ruby-6e3deb2fa9285fa95377839abff55c1f1058eded.tar.gz ruby-6e3deb2fa9285fa95377839abff55c1f1058eded.tar.xz ruby-6e3deb2fa9285fa95377839abff55c1f1058eded.zip |
* lib/pathname.rb (foreachline, dir_foreach): add obsolete warning.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/pathname.rb | 19 |
2 files changed, 14 insertions, 9 deletions
@@ -1,3 +1,7 @@ +Sun Oct 19 13:12:30 2003 Tanaka Akira <akr@m17n.org> + + * lib/pathname.rb (foreachline, dir_foreach): add obsolete warning. + Sun Oct 19 00:14:22 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> * test/soap/calc/*, test/soap/helloworkd/*: changed port# of test diff --git a/lib/pathname.rb b/lib/pathname.rb index d104be689..4822a4a17 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -302,9 +302,12 @@ class Pathname # This method is exist since 1.8.1. def each_line(*args, &block) IO.foreach(@path, *args, &block) end - # This method is obsoleted at 1.8.1. + # Pathname#foreachline is obsoleted at 1.8.1. # - alias foreachline each_line # compatibility to 1.8.0. obsoleted. + def foreachline(*args, &block) # compatibility to 1.8.0. obsoleted. + warn "Pathname#foreachline is obsoleted. Use Pathname#each_line." + each_line(*args, &block) + end def read(*args) IO.read(@path, *args) end def readlines(*args) IO.readlines(@path, *args) end @@ -402,9 +405,12 @@ class Pathname # This method is exist since 1.8.1. def each_entry(&block) Dir.foreach(@path) {|f| yield Pathname.new(f) } end - # This method is obsoleted at 1.8.1. + # Pathname#dir_foreach is obsoleted at 1.8.1. # - alias dir_foreach each_entry # compatibility to 1.8.0. obsoleted. + def dir_foreach(*args, &block) # compatibility to 1.8.0. obsoleted. + warn "Pathname#dir_foreach is obsoleted. Use Pathname#each_entry." + each_entry(*args, &block) + end def mkdir(*args) Dir.mkdir(@path, *args) end def opendir(&block) Dir.open(@path, &block) end @@ -531,11 +537,6 @@ if $0 == __FILE__ assert_equal(true, Pathname.new("///").root?) assert_equal(false, Pathname.new("").root?) assert_equal(false, Pathname.new("a").root?) - #assert_equal(true, Pathname.new(".").working_directory?) - #assert_equal(true, Pathname.new("./").working_directory?) - #assert_equal(true, Pathname.new(".//").working_directory?) - #assert_equal(false, Pathname.new("").working_directory?) - #assert_equal(false, Pathname.new("a").working_directory?) end def test_cleanpath |