summaryrefslogtreecommitdiffstats
path: root/lib
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
commit95943958eea9e56a6c05859134f2bc79822c4b79 (patch)
tree1a065d90c3e8b6f43fa10c1ebf708be3d49757cc /lib
parent621f78e29dea696cf28e4b381fcace1bc63cbbcd (diff)
downloadruby-95943958eea9e56a6c05859134f2bc79822c4b79.tar.gz
ruby-95943958eea9e56a6c05859134f2bc79822c4b79.tar.xz
ruby-95943958eea9e56a6c05859134f2bc79822c4b79.zip
* lib/find.rb (Find#find): Return an enumerator if no block is
given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/find.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/find.rb b/lib/find.rb
index 06ac9e2c0..79ff7c137 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