Issue #13969 has been updated by nobu (Nobuyoshi Nakada).


```diff
diff --git a/dir.c b/dir.c
index 44d309195c..242afa131d 100644
--- a/dir.c
+++ b/dir.c
@@ -2743,6 +2743,13 @@ dir_s_each_child(int argc, VALUE *argv, VALUE io)
     return Qnil;
 }
 
+static VALUE
+dir_each_child_m(VALUE dir)
+{
+    RETURN_ENUMERATOR(dir, 0, 0);
+    return dir_each_entry(dir, dir_yield, Qnil, TRUE);
+}
+
 static VALUE
 dir_collect_children(VALUE dir)
 {
@@ -3104,6 +3111,8 @@ Init_Dir(void)
     rb_define_method(rb_cDir,"inspect", dir_inspect, 0);
     rb_define_method(rb_cDir,"read", dir_read, 0);
     rb_define_method(rb_cDir,"each", dir_each, 0);
+    rb_define_method(rb_cDir,"each_child", dir_each_child_m, 0);
+    rb_define_method(rb_cDir,"children", dir_collect_children, 0);
     rb_define_method(rb_cDir,"rewind", dir_rewind, 0);
     rb_define_method(rb_cDir,"tell", dir_tell, 0);
     rb_define_method(rb_cDir,"seek", dir_seek, 1);
```

----------------------------------------
Feature #13969: Dir#each_child
https://bugs.ruby-lang.org/issues/13969#change-67337

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Dir has class method pairs: `Dir.entries` / `Dir.children`, `Dir.foreach` / `Dir.each_child`.
But instance method is `Dir#each` only.
How about adding `Dir#each_child`?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>