Ruby
Ruby 3.3

Run Ruby Online

Execute Ruby code instantly in a secure, isolated sandbox. No setup, no installs — just write and run.

main.rb
Output
Click "Run Code" to execute...

About Ruby

Ruby is the language behind Rails — beloved for its clean, expressive syntax. It powers GitHub, Shopify, and Airbnb. Perfect for web backends, scripting, and DSLs where developer happiness matters.

Our sandbox runs Ruby 3.3 with the full standard library. gem install is available in Pro+ sessions.

Sandbox Features

  • Secure execution with Docker + gVisor isolation
  • Ruby 3.3 with standard library
  • Up to 600s execution time (Mega tier)
  • Stdin, expected_output, command_line_arguments
  • Stateful sessions and package install (Pro+)
  • REST API for programmatic access

Use Ruby with stateful sessions

Open a session once, then call execute repeatedly — variables, files, and installed packages persist between runs. Perfect for code interpreters and REPL-style agents.

# 1. Create a session
curl -X POST https://api.sandboxapi.dev/v1/sessions \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"language":"ruby","idle_ttl":300}'
# → {"id":"sess_abc","language":"ruby",...}

# 2. Execute — first call
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"x = 42"}'

# 3. Execute again — state carries over
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"puts x * 2"}'
Read the sessions docs →

Run Code in Other Languages

Need More? Get API Access

Integrate secure code execution into your own apps with our REST API. Free tier includes 500 executions per month.

Get API Key on RapidAPI