summaryrefslogtreecommitdiff
path: root/lib/pathname.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 00:03:42 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 00:03:42 +0000
commitf398d750ea3450762c0ba10c5dea4522d4676360 (patch)
tree9ab10a31bcca7374615f35c67f6418a3d4617855 /lib/pathname.rb
parent1c9b4b8c748d7ba8b84f2ac2c123b36c2f6ec55c (diff)
* lib/pathname.rb (each_filename): return Enumerator if no block
given. * test/pathname/test_pathname.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pathname.rb')
-rw-r--r--lib/pathname.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index 45974545a6..1bc0063bb0 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -517,6 +517,7 @@ class Pathname
# # yields "usr", "bin", and "ruby".
#
def each_filename # :yield: filename
+ return to_enum(__method__) unless block_given?
prefix, names = split_names(@path)
names.each {|filename| yield filename }
nil