ruby-changes:66099
From: Burdette <ko1@a...>
Date: Sat, 8 May 2021 05:14:24 +0900 (JST)
Subject: [ruby-changes:66099] 86b4c2fc3f (master): What's Here for class Dir (#4472)
https://git.ruby-lang.org/ruby.git/commit/?id=86b4c2fc3f From 86b4c2fc3fb0ec815e212628f6708c5b777f523e Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Fri, 7 May 2021 15:14:08 -0500 Subject: What's Here for class Dir (#4472) What's Here for class Dir --- dir.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++ doc/time/zone_and_in.rdoc | 8 ++++++ timev.rb | 2 +- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 doc/time/zone_and_in.rdoc diff --git a/dir.c b/dir.c index b122b2c..812cb7c 100644 --- a/dir.c +++ b/dir.c @@ -3448,6 +3448,75 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) https://github.com/ruby/ruby/blob/trunk/dir.c#L3448 * (<code>config.h</code> and <code>main.rb</code>), the parent * directory (<code>..</code>), and the directory itself * (<code>.</code>). + * + * == What's Here + * + * \Class \Dir provides methods that are useful for: + * + * - {Reading}[#class-Dir-label-Reading] + * - {Setting}[#class-Dir-label-Setting] + * - {Querying}[#class-Dir-label-Querying] + * - {Iterating}[#class-Dir-label-Iterating] + * - {Other}[#class-Dir-label-Other] + * + * === Reading + * + * - #close:: Closes the directory stream for +self+. + * - #pos=:: Sets the position in the directory stream for +self+. + * - #read:: Reads and returns the next entry in the directory stream for +self+. + * - #rewind:: Sets the position in the directory stream for +self+ to the first entry. + * - #seek:: Sets the position in the directory stream for +self+ + * the entry at the given offset. + * + * === Setting + * + * - ::chdir:: Changes the working directory of the current process + * to the given directory. + * - ::chroot:: Changes the file-system root for the current process + * to the given directory. + * + * === Querying + * + * - ::[]:: Same as ::glob without the ability to pass flags. + * - ::children:: Returns an array of names of the children + * (both files and directories) of the given directory, + * but not including <tt>.</tt> or <tt>..</tt>. + * - ::empty?:: Returns whether the given path is an empty directory. + * - ::entries:: Returns an array of names of the children + * (both files and directories) of the given directory, + * including <tt>.</tt> and <tt>..</tt>. + * - ::exist?:: Returns whether the given path is a directory. + * - ::getwd (aliased as #pwd):: Returns the path to the current working directory. + * - ::glob:: Returns an array of file paths matching the given pattern and flags. + * - ::home:: Returns the home directory path for a given user or the current user. + * - #children:: Returns an array of names of the children + * (both files and directories) of +self+, + * but not including <tt>.</tt> or <tt>..</tt>. + * - #fileno:: Returns the integer file descriptor for +self+. + * - #path (aliased as #to_path):: Returns the path used to create +self+. + * - #tell (aliased as #pos):: Returns the integer position + * in the directory stream for +self+. + * + * === Iterating + * + * - ::each_child:: Calls the given block with each entry in the given directory, + * but not including <tt>.</tt> or <tt>..</tt>. + * - ::foreach:: Calls the given block with each entryin the given directory, + * including <tt>.</tt> and <tt>..</tt>. + * - #each:: Calls the given block with each entry in +self+, + * including <tt>.</tt> and <tt>..</tt>. + * - #each_child:: Calls the given block with each entry in +self+, + * but not including <tt>.</tt> or <tt>..</tt>. + * + * === Other + * + * - ::mkdir:: Creates a directory at the given path, with optional permissions. + * - ::new:: Returns a new \Dir for the given path, with optional encoding. + * - ::open:: Same as ::new, but if a block is given, yields the \Dir to the block, + * closing it upon block exit. + * - ::unlink (aliased as ::delete and ::rmdir):: Removes the given directory. + * - #inspect:: Returns a string description of +self+. + * */ void Init_Dir(void) diff --git a/doc/time/zone_and_in.rdoc b/doc/time/zone_and_in.rdoc new file mode 100644 index 0000000..e09e228 --- /dev/null +++ b/doc/time/zone_and_in.rdoc @@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/doc/time/zone_and_in.rdoc#L1 +- +zone+: a timezone, which may be: + - A string offset from UTC. + - A single letter offset from UTC, in the range <tt>'A'..'Z'</tt>, + <tt>'J'</tt> (the so-called military timezone) excluded. + - An integer number of seconds. + - A timezone object; + see {Timezone Argument}[#class-Time-label-Timezone+Argument] for details. +- <tt>in: zone</tt>: a timezone _zone_, which may be as above. diff --git a/timev.rb b/timev.rb index 878a4c1..1c29b66 100644 --- a/timev.rb +++ b/timev.rb @@ -75,7 +75,7 @@ class Time https://github.com/ruby/ruby/blob/trunk/timev.rb#L75 # :include: doc/time/year.rdoc # :include: doc/time/mon-min.rdoc # :include: doc/time/sec.rdoc - # :include: doc/time/in.rdoc + # :include: doc/time/zone_and_in.rdoc # def initialize(year = (now = true), mon = nil, mday = nil, hour = nil, min = nil, sec = nil, zone = nil, in: nil) if zone -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/