Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ruby Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-ruby-knowledge-patch-nevaberry-plugins)
---
name: ruby-knowledge-patch
description: Ruby
version: "4.0.10"
license: MIT
metadata:
author: Nevaberry
---
# Ruby Knowledge Patch
Load this skill when migrating Ruby applications, libraries, or native extensions,
or checking language behavior, concurrency, networking, packaging, and runtime options.
Use the topic references for complete guidance and item-specific version attribution.
## Reference index
| Reference | Topics |
| --- | --- |
| [Language and Core Behavior](references/language-and-core.md) | Syntax, mutation, reflection, strings, encodings, regexp fixes, numbers, ranges, arrays, iteration |
| [Concurrency and IO](references/concurrency-and-io.md) | Ractor ports and lifecycle, scheduler hooks, exception delivery, IO reads, filesystem and process behavior |
| [Native Extensions and Platform Builds](references/native-extensions.md) | Removed compatibility APIs, descriptor closing, GVL, native Set APIs, Windows compiler requirements |
| [Runtime, GC, and JITs](references/runtime-and-jit.md) | Ruby Box, diagnostics, backtraces, warnings, collector configuration, YJIT and ZJIT |
| [Standard Library, Networking, and Packaging](references/stdlib-networking-and-packaging.md) | Security updates, gem dependencies, loading, TCP, URI parsing, temporary files, time formatting, release tarballs |
## Breaking changes and deprecations
### Mutable strings
Mutating a literal in a file without a `frozen_string_literal` directive can warn
with `-W:deprecated` or `Warning[:deprecated] = true`. Use unary `+`, as in
`buffer = +"data"`, to obtain a mutable string without the warning, or run with
`--disable-frozen-string-literal` to restore the previous default.
Changing a string returned by `Symbol#to_s` can warn with the same settings.
Use `symbol.to_s.dup` for a mutable copy, since a future Ruby version will freeze
the returned string.
### Index assignment
Bracket assignment rejects keyword arguments and block arguments such as
`obj[0, mode: :fast] = 2` and `obj[0, &callback] = 2`. If a custom setter accepts
either, call it explicitly with `obj.[]=(0, 2, mode: :fast, &callback)` as appropriate.
### Parameter reflection
`Binding#local_variables` omits numbered block parameters, and the ordinary
local-variable get, set, and defined checks reject them. Use `implicit_parameters`,
`implicit_parameter_get`, and `implicit_parameter_defined?` on the binding to
inspect numbered parameters and `it`.
`Proc#parameters` reports an anonymous optional parameter as `[:opt]`.
Reflection code that expects `[:opt, nil]` needs to accept the shorter entry.
### Ractor communication and termination
Replace `Ractor.yield` and `Ractor#take` with sends and receives on `Ractor::Port`.
The port accepts `send` or `<<` and provides `receive`, `close`, and `closed?`.
Each Ractor's `default_port` backs its existing send and receive operations;
`close_incoming` and `close_outgoing` are removed.
```ruby
reply = Ractor::Port.new
Ractor.new(reply) { |port| port << :done }
reply.receive # => :done
```
Use `ractor.join` to wait for termination and `ractor.value` to retrieve the result.
`Ractor.select` accepts only Ractors and ports, and selecting a Ractor waits for
termination. The lower-level lifecycle API is `monitor` and `unmonitor`.
### Library dependencies and loading
`abbrev`, `base64`, `bigdecimal`, `csv`, `drb`, `getoptlong`, `mutex_m`, `nkf`,
`observer`, `resolv-replace`, `rinda`, and `syslog` move from default gems to
bundled gems. Declare the gems your application uses in its Gemfile under Bundler.
`ostruct`, `pstore`, `benchmark`, `logger`, `rdoc`, `win32ole`, `irb`, `reline`,
`readline`, and `fiddle` also move from default gems to bundled gems. Add the ones
your application uses to its Gemfile under Bundler. `win32-registry` is a default gem.
Ruby drops the default `cgi` gem and ships `cgi/escape` for escaping and unescaping
helpers. To use `SortedSet`, install the `sorted_set` gem and explicitly
`require "sorted_set"`. The old `set/sorted_set.rb` path and autoload are removed.
### IO, HTTP, and timeout changes
Ruby removes implicit subprocess creation via a leading `|` in `Kernel#open`
and the affected `IO` class methods. `Timeout.timeout` rejects negative durations.
`Net::HTTP` removes the automatic `application/x-www-form-urlencoded` fallback
for requests with a body. Set the `Content-Type` header explicitly if the server
expects one.
### Removed and deprecated APIs
`Refinement#refined_class`, `DidYouMean::SPELL_CHECKERS[]=`, and
`DidYouMean::SPELL_CHECKERS.merge!` are removed. `ObjectSpace._id2ref` is deprecated.
`Process::Status#&` and `Process::Status#>>` are removed. The `--rjit` flag is removed.
`rb_thread_fd_close` is deprecated and does nothing. Wrap a descriptor exposed
to Ruby in an IO with `RUBY_IO_MODE_EXTERNAL` and close it with `rb_io_close(io)`
to interrupt and wait for pending operations on that IO.
The native-extension reference includes the other removed C APIs and macros.
### Buffer and encoding constraints
Use a separate `buffer:` for `Array#pack` when a string in the input would
otherwise be packed into itself. `Encoding::Converter#primitive_convert` requires
distinct source and destination buffers if both are strings.
Ruby 4.0.10 rejects UTF-32 code units whose most significant byte is `0x80` or
greater. `String#valid_encoding?` can now return `false` for these inputs.
## Security updates
Upgrade Ruby 4.0 installations to 4.0.10 or later for seven security fixes covering
string case conversion and regexp compilation, matching, and `Regexp#to_s`.
Ruby 4.0.10 also updates the default `json` gem from 2.18.0 to 2.18.3, which fixes
CVE-2026-33210.
Upgrade the `resolv` gem bundled with Ruby to address CVE-2026-80212 and
CVE-2026-80213. The standard-library reference also covers the Ruby 4.0 DNS
timeout fix and the Ruby 3.2 bundled `zlib` update.
## Core APIs and iteration
### Strings and core collections
`String#append_as_bytes` concatenates its arguments without encoding validation
or conversion. `strip`, `lstrip`, `rstrip`, and their bang variants accept selectors
for which characters to trim, as in `"__name__".strip("_")`.
`Pathname` and `Set` are core classes available without a `require`.
`Set#inspect` prints in the form `Set[1, 2, 3]`, and passing arguments to
`Set#to_set` or `Enumerable#to_set` is deprecated.
### Sized and unbounded iteration
`Enumerator.produce` accepts `size:` as an integer, `Float::INFINITY`, a callable,
or `nil` for unknown size. The default is `Float::INFINITY`, and the block still
controls when iteration stops, as in
`Enumerator.produce(1, size: 1) { raise StopIteration }`.
`Range#step` advances with `+` for nonnumeric values as well, so a time range can
step by seconds. `Range#size` raises `TypeError` for a non-iterable range.
`Range#to_set` checks the range's size before materializing it, guarding against
endless ranges. `Range#overlap?` handles unbounded ranges.
## Scheduling and exception delivery
Schedulers can implement the optional `blocking_operation_wait` hook to move
blocking operations out of the event loop. They can implement `fiber_interrupt`
to deliver an exception to a fiber, such as when its pending IO is closed, and
`yield` to keep processing with signal exceptions disabled.
Asynchronous `IO#close` can use the restored `io_close` hook, and flushing an IO
write buffer invokes `io_write`.
`Thread#raise` and `Fiber#raise` accept `cause:` to set the delivered exception's
cause. `Exception#set_backtrace` accepts an array of `Thread::Backtrace::Location`
objects, so a handler can pass `caller_locations` directly. `Kernel#raise`,
`Thread#raise`, and `Fiber#raise` accept the same format as their backtrace argument.
## TCP connection controls
`Socket.tcp`, `TCPSocket.new`, and `TCPSocket.open` use Happy Eyeballs v2 by default
to race IPv6 and IPv4 connection attempts. Disable it for one call with
`fast_fallback: false`, or process-wide with `Socket.tcp_fast_fallback = false`
or `RUBY_TCP_NO_FAST_FALLBACK=1`.
Specifying a local port disables TCP fast fallback. Ruby 4.0.10 also fixes an IPv4
local bind address on the fast-fallback path when a local port is omitted.
`Socket.tcp` and `TCPSocket.new` accept `open_timeout:` for the initial connection.
`TCPSocket.new` raises `IO::TimeoutError` when the caller's timeout expires.
OS-level timeouts and some `Socket.tcp` timeout paths can raise `Errno::ETIMEDOUT`.
## Runtime configuration
### Isolation and garbage collection
Set `RUBY_BOX=1` when launching Ruby to enable the experimental `Ruby::Box` API.
A box isolates definitions loaded into it, including monkey patches, class and
global variable changes, and Ruby and native libraries.
`GC.config` can change settings on the running collector.
`GC.config(rgengc_allow_full_mark: false)` restricts marking to young objects;
the setting defaults to `true`.
Configure Ruby with `--with-modular-gc` to select a collector at runtime through
`RUBY_GC_LIBRARY`. Build the experimental MMTk collector with
`make modular-gc MODULAR_GC=mmtk` on a machine with Rust, then run with
`RUBY_GC_LIBRARY=mmtk`.
### JITs and memory limits
Build Ruby with Rust 1.85.0 or later for experimental ZJIT support, then enable it
with `ruby --zjit` or `RubyVM::ZJIT.enable`. Ruby 4.0.10 enables ZJIT when the build
is configured with `--enable=zjit`.
`--yjit-mem-size` sets the unified YJIT memory limit, which defaults to 128 MiB.
`RubyVM::YJIT.enable` adds `mem_size:` and `call_threshold:`. Collecting
`ratio_in_yjit` requires building with `--enable-yjit=stats` and running with
`--yjit-stats`.
`--yjit-exec-mem-size` and `--zjit-exec-mem-size` reject values whose reservation
size exceeds the unsigned 32-bit limit. The runtime reference also covers YJIT
compilation logs, exit tracing, and codegen profiling.
## Artifact signatures and lockfile checksums
`gem push` accepts `--attestation` to store a build artifact signature with Sigstore.
`bundle config set lockfile_checksums true` adds checksums to new lockfiles, and
`bundle lock --add-checksums` adds them to an existing lockfile.