From 5cf4087000ea3d1c2249273bc4484c168df39842 Mon Sep 17 00:00:00 2001 From: Alexander Bulancov <6594487+trinistr@users.noreply.github.com> Date: Sun, 1 Feb 2026 20:51:44 +0300 Subject: [PATCH 1/6] [DOC] Fix typos in IO::Buffer's docs --- io_buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/io_buffer.c b/io_buffer.c index f1afc3d3baf48e..4bb4685e744d99 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -1481,7 +1481,7 @@ rb_io_buffer_locked(VALUE self) * * for a buffer created from scratch: free memory. * * for a buffer created from string: undo the association. * - * After the buffer is freed, no further operations can't be performed on it. + * After the buffer is freed, no further operations can be performed on it. * * You can resize a freed buffer to re-allocate it. * @@ -3500,7 +3500,7 @@ memory_not(unsigned char * restrict output, unsigned char * restrict base, size_ * call-seq: * ~source -> io_buffer * - * Generate a new buffer the same size as the source by applying the binary NOT + * Generate a new buffer the same size as the source by applying the unary NOT * operation to the source. * * ~IO::Buffer.for("1234567890") @@ -3690,7 +3690,7 @@ memory_not_inplace(unsigned char * restrict base, size_t size) * call-seq: * source.not! -> io_buffer * - * Modify the source buffer in place by applying the binary NOT + * Modify the source buffer in place by applying the unary NOT * operation to the source. * * source = IO::Buffer.for("1234567890").dup # Make a read/write copy. From 3ab35e5e2e9dfa156aa87d30a90a66593198400d Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sun, 1 Feb 2026 20:56:21 -0600 Subject: [PATCH 2/6] [DOC] Doc for Module.new --- object.c | 62 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/object.c b/object.c index 07eb1d8e975251..a7b72196d59fb8 100644 --- a/object.c +++ b/object.c @@ -2126,28 +2126,52 @@ static VALUE rb_mod_initialize_exec(VALUE module); /* * call-seq: - * Module.new -> mod - * Module.new {|mod| block } -> mod + * Module.new -> new_module + * Module.new {|module| ... } -> new_module * - * Creates a new anonymous module. If a block is given, it is passed - * the module object, and the block is evaluated in the context of this - * module like #module_eval. + * Returns a new anonymous module. * - * fred = Module.new do - * def meth1 - * "hello" - * end - * def meth2 - * "bye" - * end - * end - * a = "my string" - * a.extend(fred) #=> "my string" - * a.meth1 #=> "hello" - * a.meth2 #=> "bye" + * The module may be assigned to a name, + * which should be a constant name + * in capitalized {camel case}[https://en.wikipedia.org/wiki/Camel_case] + * (e.g., +MyModule+, not +MY_MODULE+). + * + * With no block given, returns the new module. + * + * MyModule = Module.new + * MyModule.class # => Module + * MyModule.name # => "MyModule" + * + * With a block given, calls the block with the new (not yet named) module: + * + * MyModule = Module.new {|m| p [m.class, m.name] } + * # => MyModule + * MyModule.class # => Module + MyModule.name # => "MyModule" + * + * Output (from the block): + * + * [Module, nil] + * + * The block may define methods and constants for the module: + * + * MyModule = Module.new do |m| + * MY_CONSTANT = "#{MyModule} constant value" + * def self.method1 = "#{MyModule} first method (singleton)" + * def method2 = "#{MyModule} Second method (instance)" + * end + * MyModule.method1 # => "MyModule first method (singleton)" + * class Foo + * include MyModule + * def speak + * MY_CONSTANT + * end + * end + * foo = Foo.new + * foo.method2 # => "MyModule Second method (instance)" + * foo.speak + * # => "MyModule constant value" * - * Assign the module to a constant (name starting uppercase) if you - * want to treat it like a regular module. */ static VALUE From 34f848b366f72ef04a29097ed2e72e748ecbb4ae Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 30 Jan 2026 17:11:59 -0500 Subject: [PATCH 3/6] [DOC] Fix hash style in Hash#dig --- hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash.c b/hash.c index dbd8f76950fb28..fc8bfa24eb2f36 100644 --- a/hash.c +++ b/hash.c @@ -4850,7 +4850,7 @@ rb_hash_any_p(int argc, VALUE *argv, VALUE hash) * h.dig(:hello) # => nil * h.default_proc = -> (hash, _key) { hash } * h.dig(:hello, :world) - * # => {:foo=>{:bar=>[:a, :b, :c]}} + * # => {foo: {bar: [:a, :b, :c]}} * * Related: {Methods for Fetching}[rdoc-ref:Hash@Methods+for+Fetching]. */ From 70cc932d2791e885c1f085ca5fdd45ded09dd1a8 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Sun, 1 Feb 2026 12:45:43 -0500 Subject: [PATCH 4/6] [ruby/rubygems] Fix nil `@revision` in `git_proxy.rb` https://github.com/ruby/rubygems/commit/69d955eb67 --- lib/bundler/source/git/git_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index cd352c22a7abbc..fe05e9d57b2789 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -137,7 +137,7 @@ def copy_to(destination, submodules = false) git "fetch", "--force", "--quiet", *extra_fetch_args(ref), dir: destination end - git "reset", "--hard", @revision, dir: destination + git "reset", "--hard", revision, dir: destination if submodules git_retry "submodule", "update", "--init", "--recursive", dir: destination From 9368ec5e8b992856d554f57c56e4d5a9c45f0f38 Mon Sep 17 00:00:00 2001 From: Steven Webb Date: Sun, 11 Jan 2026 18:08:09 +0800 Subject: [PATCH 5/6] Rewrite Array#find in ruby Inspired by https://bugs.ruby-lang.org/issues/20182 and https://github.com/ruby/ruby/pull/9533. This PR provides a performance boost to Array#find when run using JIT compilation. This is achieved by implementing Array#find in Ruby, which the JIT compiler can optimise. [PR#15189](https://github.com/ruby/ruby/pull/15189) added a C implementation for Array#find instead of relying on Enumerable#find. This PR extends this by adding a Ruby implementation. I used the so_fasta benchmark to measure performance. No change in interpreted performance before/after: $ benchmark-driver -e "~/.rubies/ruby-master/bin/ruby; ~/.rubies/ruby-array-find-native/bin/ruby" ../benchmark/so_fasta.rb Calculating ------------------------------------- ~/.rubies/ruby-master/bin/ruby ~/.rubies/ruby-array-find-native/bin/ruby so_fasta 0.393 0.393 i/s - 1.000 times in 2.543209s 2.545514s Comparison: so_fasta ~/.rubies/ruby-master/bin/ruby: 0.4 i/s ~/.rubies/ruby-array-find-native/bin/ruby: 0.4 i/s - 1.00x slower With YJIT enabled Array#find is almost twice as fast: $ benchmark-driver -e "~/.rubies/ruby-array-find-native/bin/ruby; ~/.rubies/ruby-array-find-native/bin/ruby --yjit" ../benchmark/so_fasta.rb Calculating ------------------------------------- ~/.rubies/ruby-array-find-native/bin/ruby ~/.rubies/ruby-array-find-native/bin/ruby --yjit so_fasta 0.393 0.770 i/s - 1.000 times in 2.547550s 1.298371s Comparison: so_fasta ~/.rubies/ruby-array-find-native/bin/ruby --yjit: 0.8 i/s ~/.rubies/ruby-array-find-native/bin/ruby: 0.4 i/s - 1.96x slower --- array.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/array.rb b/array.rb index 81beff0b1c4016..93ca4f3a3ec5ab 100644 --- a/array.rb +++ b/array.rb @@ -283,5 +283,23 @@ def select # :nodoc: alias filter select end end + + if Primitive.rb_builtin_basic_definition_p(:find) + undef :find + + def find(if_none_proc = nil) # :nodoc: + Primitive.attr! :inline_block, :c_trace + + unless defined?(yield) + return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)' + end + _i = 0 + value = nil + while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) }) + return value if yield(value) + end + if_none_proc ? if_none_proc.call : nil + end + end end end From 9715b29a19c1fcb714b0de67ab373f808fb3ac9d Mon Sep 17 00:00:00 2001 From: Steven Webb Date: Sun, 11 Jan 2026 21:13:27 +0800 Subject: [PATCH 6/6] Update array.rb Co-authored-by: Nobuyoshi Nakada --- array.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/array.rb b/array.rb index 93ca4f3a3ec5ab..f45e6a0d5e5ade 100644 --- a/array.rb +++ b/array.rb @@ -298,7 +298,7 @@ def find(if_none_proc = nil) # :nodoc: while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) }) return value if yield(value) end - if_none_proc ? if_none_proc.call : nil + if_none_proc&.call end end end