summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-23 02:18:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-23 02:18:52 (GMT)
commit96db72ce38b27799dd8e80ca00696e41234db6ba (patch)
tree4c210692772faf26ed8ddac746dc79aec0240e2d /dir.c
parentb9d01e225723b3dfb6e18d0dcb790c20fef78d63 (diff)
[DOC] missing docs at toplevel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index 71eb935..8ac8ee9 100644
--- a/dir.c
+++ b/dir.c
@@ -2859,6 +2859,26 @@ dir_s_each_child(int argc, VALUE *argv, VALUE io)
return Qnil;
}
+/*
+ * call-seq:
+ * dir.each_child {| filename | block } -> nil
+ * dir.each_child -> an_enumerator
+ *
+ * Calls the block once for each entry except for "." and ".." in
+ * this directory, passing the filename of each entry as a parameter
+ * to the block.
+ *
+ * If no block is given, an enumerator is returned instead.
+ *
+ * d = Dir.new("testdir")
+ * d.each_child {|x| puts "Got #{x}" }
+ *
+ * <em>produces:</em>
+ *
+ * Got config.h
+ * Got main.rb
+ *
+ */
static VALUE
dir_each_child_m(VALUE dir)
{
@@ -2866,6 +2886,17 @@ dir_each_child_m(VALUE dir)
return dir_each_entry(dir, dir_yield, Qnil, TRUE);
}
+/*
+ * call-seq:
+ * dir.children -> array
+ *
+ * Returns an array containing all of the filenames except for "."
+ * and ".." in this directory.
+ *
+ * d = Dir.new("testdir")
+ * d.children #=> ["config.h", "main.rb"]
+ *
+ */
static VALUE
dir_collect_children(VALUE dir)
{