From 5b7cb170cfd2d573272a14be3421b5db4dfa0f87 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Fri, 7 May 2021 11:43:50 -0500 Subject: [PATCH 1/3] What's Here for class Dir --- dir.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/dir.c b/dir.c index b122b2cb90d46d..262269daff36c3 100644 --- a/dir.c +++ b/dir.c @@ -3448,6 +3448,83 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) * (config.h and main.rb), the parent * directory (..), and the directory itself * (.). + * + * == What's Here + * + * \Class \Dir provides methods that are useful for: + * + * - {Creating}[#class-Dir-label-Creating] + * - {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] + * + * === Creating + * + * - ::mkdir:: Creates and returns a new \Directory at the given path, + * with optional permissions. + * - ::new:: Creates and returns a new \Directory at the given path, + * with optional encoding. + * + * === Reading + * + * - ::open:: Opens and returns a \Directory at the given path, with optional encoding; + * the directory stream is positioned at the first entry. + * - #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. + * - #tell:: Returns the integer position in the directory stream for +self+. + * + * === 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 + * + * - ::[]:: Returns an array of file paths that match the given pattern. + * - ::children:: Returns an array of names of the children + * (both files and directories) of the given directory, + * but not including . or ... + * - ::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 . and ... + * - ::exist?:: Returns whether the given path is a directory. + * - ::getwd:: Returns the path to the current working directory. + * - ::glob:: Returns an array of file paths matching the given pattern. + * - ::home:: Returns the home directory path for a user, if given, + * else for the current user. + * - ::pwd:: Returns the path to the current working directory. + * - #children:: Returns an array of names of the children + * (both files and directories) of +self+, + * but not including . or ... + * - #fileno:: Returns the integer file descriptor for +self+. + * - #path (aliased as #to_path):: Returns the path used to create +self+. + * - #pos:: Returns the current position in the directory stream for +self+. + * + * === Iterating + * + * - ::each_child:: Calls the given block with each entry + * in the given directory. + * - ::foreach:: Calls the given block with each entry + * in the given directory, with an optional encoding for the entries. + * - #each:: Calls the given block with each entry in +self+, + * including . and ... + * - #each_child:: Calls the given block with each entry in +self+, + * but not including . or ... + * + * === Other + * + * - #inspect:: Returns a string description of +self+. + * - ::unlink (aliased as ::delete and ::rmdir):: Removes the given directory. + * */ void Init_Dir(void) From 1a7e7112621194d8187a3b2159ef3f7d2de27120 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Fri, 7 May 2021 13:31:34 -0500 Subject: [PATCH 2/3] Patch for Time.new doc (as requested) --- doc/time/zone_and_in.rdoc | 8 ++++++++ timev.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 doc/time/zone_and_in.rdoc diff --git a/doc/time/zone_and_in.rdoc b/doc/time/zone_and_in.rdoc new file mode 100644 index 00000000000000..e09e22874beca1 --- /dev/null +++ b/doc/time/zone_and_in.rdoc @@ -0,0 +1,8 @@ +- +zone+: a timezone, which may be: + - A string offset from UTC. + - A single letter offset from UTC, in the range 'A'..'Z', + 'J' (the so-called military timezone) excluded. + - An integer number of seconds. + - A timezone object; + see {Timezone Argument}[#class-Time-label-Timezone+Argument] for details. +- in: zone: a timezone _zone_, which may be as above. diff --git a/timev.rb b/timev.rb index 878a4c14e806e3..1c29b6684f282b 100644 --- a/timev.rb +++ b/timev.rb @@ -75,7 +75,7 @@ class Time # :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 From fb48d5f48934753548ce16be04680f0b4c9973fb Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Fri, 7 May 2021 14:19:20 -0500 Subject: [PATCH 3/3] What's Here for class Dir --- dir.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/dir.c b/dir.c index 262269daff36c3..812cb7cbe4d9fa 100644 --- a/dir.c +++ b/dir.c @@ -3453,31 +3453,20 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) * * \Class \Dir provides methods that are useful for: * - * - {Creating}[#class-Dir-label-Creating] * - {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] * - * === Creating - * - * - ::mkdir:: Creates and returns a new \Directory at the given path, - * with optional permissions. - * - ::new:: Creates and returns a new \Directory at the given path, - * with optional encoding. - * * === Reading * - * - ::open:: Opens and returns a \Directory at the given path, with optional encoding; - * the directory stream is positioned at the first entry. * - #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. - * - #tell:: Returns the integer position in the directory stream for +self+. * * === Setting * @@ -3488,7 +3477,7 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) * * === Querying * - * - ::[]:: Returns an array of file paths that match the given pattern. + * - ::[]:: 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 . or ... @@ -3497,24 +3486,23 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) * (both files and directories) of the given directory, * including . and ... * - ::exist?:: Returns whether the given path is a directory. - * - ::getwd:: Returns the path to the current working directory. - * - ::glob:: Returns an array of file paths matching the given pattern. - * - ::home:: Returns the home directory path for a user, if given, - * else for the current user. - * - ::pwd:: Returns the path to the current working 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 . or ... * - #fileno:: Returns the integer file descriptor for +self+. * - #path (aliased as #to_path):: Returns the path used to create +self+. - * - #pos:: Returns the current position in the directory stream for +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. - * - ::foreach:: Calls the given block with each entry - * in the given directory, with an optional encoding for the entries. + * - ::each_child:: Calls the given block with each entry in the given directory, + * but not including . or ... + * - ::foreach:: Calls the given block with each entryin the given directory, + * including . and ... * - #each:: Calls the given block with each entry in +self+, * including . and ... * - #each_child:: Calls the given block with each entry in +self+, @@ -3522,8 +3510,12 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname) * * === Other * - * - #inspect:: Returns a string description of +self+. + * - ::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