explaingit

eregon/ractor-shim

Analysis updated 2026-08-12 · repo last pushed 2026-03-05

14RubyAudience · developerComplexity · 2/5MaintainedSetup · easy

TLDR

A small Ruby gem that lets code using Ruby's Ractor parallel-execution feature run on Ruby versions and implementations that don't natively support Ractors, falling back to threads and queues.

Mindmap

mindmap
  root((repo))
  What it does
    Enables Ractor code everywhere
    Falls back to threads and queues
    Previews Ruby 4.0 API
  Tech stack
    Ruby gem
    Threads and queues
    Supports Ruby 2.7 to 3.4
  Use cases
    Cross-Ruby compatibility
    JRuby and TruffleRuby support
    Early Ruby 4.0 API access
  Audience
    Ruby library developers
    Multi-platform maintainers
  Tradeoffs
    make_shareable skips deep-freeze
    Relies on well-behaved code
    Performance over strictness

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a Ruby library using Ractors that also works on JRuby or TruffleRuby without crashing.

USE CASE 2

Write code against the upcoming Ruby 4.0 Ractor API before it officially ships.

USE CASE 3

Run Ractor-based Ruby code on older Ruby versions (2.7 through 3.4) that lack native Ractor support.

What is it built with?

Ruby

How does it compare?

eregon/ractor-shimeclectic-coding/rails_health_checksruby/tmpdir
Stars141414
LanguageRubyRubyRuby
Last pushed2026-03-052026-07-13
MaintenanceMaintainedActive
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Install the gem with Bundler or gem install, no external dependencies or infrastructure required.

In plain English

Ractor-shim is a small Ruby gem that lets code written for Ruby's Ractor feature run on Ruby versions or implementations that don't natively support Ractors. Ractors are Ruby's relatively new way to run code in true parallel, but not every Ruby environment includes them. This gem fills that gap so the same code can work everywhere without modification. At a high level, it recreates the Ractor API using Ruby's older building blocks: threads and queues. If your Ruby environment already has Ractors built in, the gem steps aside and does nothing. If it doesn't, the gem defines a compatible version of Ractor using those underlying threading tools. It also provides a preview of the upcoming Ruby 4.0 Ractor API for current standard Ruby versions (2.7 through 3.4), so you can write code against the newer interface before it officially ships. This is useful for developers building Ruby applications that need to run across different Ruby implementations, for example, someone writing a library that uses Ractors but wants it to also work on TruffleRuby or JRuby, which run Ruby code in parallel threads rather than using native Ractors. Without this gem, code that calls Ractor.new would simply crash on those platforms. With it, the same code runs, taking advantage of the parallel threading those implementations already provide. One notable tradeoff: when Ractors aren't natively available, the gem's version of Ractor.make_shareable, a method normally used to safely share objects between parallel workers, simply returns the object unchanged. This skips the usual deep-freezing step for performance reasons, reasoning that the standard behavior makes objects immutable anyway, so there's no practical risk. This keeps things fast but relies on code being well-behaved.

Copy-paste prompts

Prompt 1
Install the ractor-shim gem and write a small Ruby script that uses Ractor.new to run two tasks in parallel, then run it on a Ruby version that doesn't natively support Ractors to confirm it works.
Prompt 2
Use ractor-shim to make an existing Ruby codebase that calls Ractor.make_shareable and Ractor.new compatible with TruffleRuby or JRuby without modifying the application logic.
Prompt 3
Explore how ractor-shim falls back to threads and queues when native Ractors are unavailable, and compare the behavior of Ractor.make_shareable on standard Ruby versus the shim by writing a test script.

Frequently asked questions

What is ractor-shim?

A small Ruby gem that lets code using Ruby's Ractor parallel-execution feature run on Ruby versions and implementations that don't natively support Ractors, falling back to threads and queues.

What language is ractor-shim written in?

Mainly Ruby. The stack also includes Ruby.

Is ractor-shim actively maintained?

Maintained — commit in last 6 months (last push 2026-03-05).

How hard is ractor-shim to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ractor-shim for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.