mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ed4139e39b
commit
af0c875e26
2 changed files with 7 additions and 0 deletions
|
|
@ -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>
|
Wed Jun 11 01:28:12 2008 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* include/ruby/intern.h, proc.c: revert rb_proc_call() and
|
* include/ruby/intern.h, proc.c: revert rb_proc_call() and
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ module Find
|
||||||
# See the +Find+ module documentation for an example.
|
# See the +Find+ module documentation for an example.
|
||||||
#
|
#
|
||||||
def find(*paths) # :yield: path
|
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}
|
paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}
|
||||||
while file = paths.shift
|
while file = paths.shift
|
||||||
catch(:prune) do
|
catch(:prune) do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue