aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-10 18:41:25 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-10 18:41:25 +0000
commitaf0c875e26280869f216f69608919a8c721e4c68 (patch)
tree1a065d90c3e8b6f43fa10c1ebf708be3d49757cc
parented4139e39bb3ceda2985b2ea2ebd9a91479d25da (diff)
downloadruby-af0c875e26280869f216f69608919a8c721e4c68.tar.gz
* lib/find.rb (Find#find): Return an enumerator if no block is
given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/find.rb2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b308330b6..143ede6476 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jun 11 03:40:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/find.rb (Find#find): Return an enumerator if no block is
+ given.
+
Wed Jun 11 01:28:12 2008 Koichi Sasada <ko1@atdot.net>
* include/ruby/intern.h, proc.c: revert rb_proc_call() and
diff --git a/lib/find.rb b/lib/find.rb
index 06ac9e2c0c..79ff7c1378 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -33,6 +33,8 @@ module Find
# See the +Find+ module documentation for an example.
#
def find(*paths) # :yield: path
+ block_given? or return enum_for(__method__, *paths)
+
paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}
while file = paths.shift
catch(:prune) do