Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

1.8.7: Dir#each, .foreach (optional block)

  • Loading branch information...
commit 54757d603a56cf3a1da5faeda45d33a10711baca 1 parent 4cbf1e7
@marcandre marcandre authored
Showing with 3 additions and 0 deletions.
  1. +1 −0  AUTHORS
  2. +2 −0  kernel/common/dir.rb
View
1  AUTHORS
@@ -106,6 +106,7 @@
- Luis Lavena:
- Luke Randall:
- Makoto Kuwata:
+- Marc-Andre Lafortune: { irc: marcandre }
- Marcus Crafter: { irc: crafterm }
- Marius Nuennerich:
- Mark Somerville:
View
2  kernel/common/dir.rb
@@ -427,6 +427,7 @@ def self.entries(path)
end
def self.foreach(path)
+ return to_enum :foreach, path unless block_given? || Rubinius::TARGET_IS_186
self.open(path) do |dir|
while s = dir.read
yield s
@@ -454,6 +455,7 @@ def path
end
def each
+ return to_enum unless block_given? || Rubinius::TARGET_IS_186
while s = read
yield s
end
Please sign in to comment.
Something went wrong with that request. Please try again.