Does this Ruby online compiler run real Ruby?
expand_more
Yes. It runs CRuby, the reference interpreter published on ruby-lang.org, compiled to WebAssembly by the official ruby.wasm project. Output comes from the interpreter itself rather than from reading your code, so core classes, blocks, pattern matching and metaprogramming behave as they do on your computer. RUBY_VERSION reports the exact release.
Which Ruby version does the playground use?
expand_more
Ruby 3.4, currently release 3.4.1, from ruby.wasm 2.8.1 (WebAssembly). Print RUBY_VERSION or RUBY_PLATFORM to check. The platform is wasm32-wasi instead of something like x86_64-linux or arm64-darwin, which is how a script can tell that it is running on WebAssembly. The release is fixed by the interpreter file the page loads, so everyone runs the same one.
Can I install gems or run Rails?
expand_more
No. There is no Bundler or gem install step, the interpreter has no network access, and native extensions cannot be compiled in the browser. Default libraries such as json, set, date, time and stringio load with require. Bundled gems like bigdecimal are missing, and Rails, which needs a server and a database, will not run.
Why is the first run slower than the next ones?
expand_more
The interpreter and its standard library form a WebAssembly file of about 30 MB, roughly 8 MB when compressed in transit. It is downloaded only when you first press Run, compiled once and kept in memory, so later runs in the same tab only start a new Ruby VM, which usually takes well under a second.
How are Ruby errors and exceptions shown?
expand_more
An uncaught exception ends the script. The output panel keeps everything printed before it, then shows the exception class and message, such as ZeroDivisionError: divided by 0, and the line in main.rb where it was raised. Syntax errors are printed the way Ruby 3.4's Prism parser reports them, with a pointer to the problem.
Is my Ruby code sent to a server?
expand_more
No. Your program runs inside your browser tab and is not sent to WebFiddle to be executed; only the interpreter file is downloaded, from the jsDelivr CDN. The code leaves your device only if you press Share and send someone the link, because that link stores the program, compressed, in its URL.