diff --git a/gc.c b/gc.c index fa903752bf111e..d0dc70ff7fb356 100644 --- a/gc.c +++ b/gc.c @@ -2709,29 +2709,34 @@ count_objects_i(VALUE obj, void *d) /* * call-seq: - * ObjectSpace.count_objects([result_hash]) -> hash + * ObjectSpace.count_objects(result_hash = {}) -> hash * - * Counts all objects grouped by type. + * Counts the number of objects, grouped by type. * - * It returns a hash, such as: - * { - * TOTAL: 10000, - * FREE: 3011, - * T_OBJECT: 6, - * T_CLASS: 404, - * # ... - * } + * It returns a hash that looks like: * - * The contents of the returned hash are implementation specific. - * It may be changed in future. + * { + * TOTAL: 10000, + * FREE: 3011, + * T_OBJECT: 6, + * T_CLASS: 404, + * # ... + * } * - * The keys starting with +:T_+ means live objects. + * The contents of the returned hash are implementation specific and + * may be changed in future versions without notice. + * + * The keys starting with +:T_+ are live objects of a particular type. * For example, +:T_ARRAY+ is the number of arrays. - * +:FREE+ means object slots which is not used now. - * +:TOTAL+ means sum of above. + * + * The key +:FREE+ is the number of object slots which are empty. + * + * The key +:TOTAL+ is the total number of slots (which is the sum of + * all of the other values). * * If the optional argument +result_hash+ is given, - * it is overwritten and returned. This is intended to avoid probe effect. + * it is overwritten and returned. + * This is intended to avoid the probe effect. * * h = {} * ObjectSpace.count_objects(h) diff --git a/pathname_builtin.rb b/pathname_builtin.rb index 03b71f79868aac..60f936632fc120 100644 --- a/pathname_builtin.rb +++ b/pathname_builtin.rb @@ -1105,8 +1105,12 @@ def each_line(...) # :yield: line # def read(...) File.read(@path, ...) end - # See File.binread. Returns all the bytes from the file, or the first +N+ - # if specified. + # call-seq: + # binread(length = nil, offset = 0) -> string or nil + # + # Behaves like #read, except that the file is opened in binary mode + # with ASCII-8BIT encoding. + # def binread(...) File.binread(@path, ...) end # See File.readlines. Returns all the lines from the file. @@ -1152,9 +1156,11 @@ def sysopen(...) File.sysopen(@path, ...) end # def write(...) File.write(@path, ...) end - # Writes +contents+ to the file, opening it in binary mode. + # call-seq: + # binwrite(string, offset = 0, **opts) -> nonnegative_integer # - # See File.binwrite. + # Behaves like #write, except that the file is opened in binary mode + # with ASCII-8BIT encoding. def binwrite(...) File.binwrite(@path, ...) end # call-seq: @@ -1342,10 +1348,34 @@ def realdirpath(...) self.class.new(File.realdirpath(@path, ...)) end class Pathname # * FileTest * - # See FileTest.blockdev?. + # call-seq: + # blockdev? => true or false + # + # Returns whether +self+ represents a block device + # (i.e., a random-access device): + # + # Pathname.new('/dev/nvme0n1').blockdev? # => true + # Pathname.new('/dev/loop0').blockdev? # => true + # Pathname.new('/dev/tty').blockdev? # => false + # Pathname.new('/dev/null').blockdev? # => false + # Pathname.new('nosuch').blockdev? # => false + # + # The returned value is OS-dependent; on Windows, almost always +false+. def blockdev?() FileTest.blockdev?(@path) end - # See FileTest.chardev?. + # call-seq: + # chardev? => true or false + # + # Returns whether +self+ represents a character device + # (i.e., a sequential-access device): + # + # Pathname.new('/dev/tty').chardev? # => true + # Pathname.new('/dev/null').chardev? # => true + # Pathname.new('/dev/nvme0n1').chardev? # => false + # Pathname.new('/dev/loop0').chardev? # => false + # Pathname.new('nosuch').chardev? # => false + # + # The returned value is OS-dependent; on Windows, almost always +false+. def chardev?() FileTest.chardev?(@path) end # Tests the file is empty. diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb index ffe3b1f760a626..c532638e0990f9 100644 --- a/test/io/wait/test_io_wait.rb +++ b/test/io/wait/test_io_wait.rb @@ -23,7 +23,7 @@ def test_wait omit 'unstable on MinGW' if /mingw/ =~ RUBY_PLATFORM assert_nil @r.wait(0) @w.syswrite "." - sleep 0.1 + IO.select([@r]) assert_equal @r, @r.wait(0) end diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 7c55ce8628ff13..5727ee00c57d1b 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -108,12 +108,6 @@ def lib((upstream, branch), gemspec_in_subdir: false) ]), "open-uri": lib("ruby/open-uri"), English: lib("ruby/English"), - cgi: repo("ruby/cgi", [ - ["ext/cgi", "ext/cgi"], - ["lib/cgi/escape.rb", "lib/cgi/escape.rb"], - ["test/cgi/test_cgi_escape.rb", "test/cgi/test_cgi_escape.rb"], - ["test/cgi/update_env.rb", "test/cgi/update_env.rb"], - ]), date: repo("ruby/date", [ ["doc/date", "doc/date"], ["ext/date", "ext/date"], @@ -202,12 +196,6 @@ def lib((upstream, branch), gemspec_in_subdir: false) optparse: lib("ruby/optparse", gemspec_in_subdir: true).tap { it.mappings << ["doc/optparse", "doc/optparse"] }, - pathname: repo("ruby/pathname", [ - ["ext/pathname/pathname.c", "pathname.c"], - ["lib/pathname_builtin.rb", "pathname_builtin.rb"], - ["lib/pathname.rb", "lib/pathname.rb"], - ["test/pathname", "test/pathname"], - ]), pp: lib("ruby/pp"), prettyprint: lib("ruby/prettyprint"), prism: repo(["ruby/prism", "main"], [ @@ -445,7 +433,7 @@ def sync_default_gems(gem) end def check_prerelease_version(gem) - return if ["rubygems", "mmtk", "cgi", "pathname", "Onigmo"].include?(gem) + return if ["rubygems", "mmtk", "Onigmo"].include?(gem) require "net/https" require "json"