.RB Ruby Source Code
.rb

Ruby Source Code

RB (.rb) files contain source code in the Ruby programming language, a dynamic, interpreted language created by Yukihiro Matsumoto in 1995. Ruby emphasizes developer happiness with elegant syntax and powers the Ruby on Rails web framework.

File structure
Header schema
Records structured data
Source CodeText FormatInterpretedDynamic Typing1995
By FileDex
Not convertible

Source code format. Conversion is not applicable.

Common questions

What is the difference between .rb and .erb files?

RB files contain pure Ruby source code. ERB (Embedded Ruby) files mix Ruby code with HTML templates using <% %> tags, commonly used for Rails views.

Can Ruby run on the JVM?

Yes. JRuby compiles Ruby code to JVM bytecode, enabling Ruby programs to use Java libraries and run on any platform with a JVM.

Is Ruby still relevant in 2026?

Yes. Ruby powers major platforms like GitHub, Shopify, and Basecamp. Ruby 3.3+ with YJIT delivers significantly improved performance, and Rails 8 continues active development.

What makes .RB special

What is an RB file?

RB files contain source code in Ruby, a dynamic, interpreted programming language designed for developer happiness. Created by Yukihiro "Matz" Matsumoto in 1995, Ruby emphasizes elegant syntax, object-oriented design, and the principle of least surprise. It powers the Ruby on Rails web framework.

Continue reading — full technical deep dive

How to open RB files

  • VS Code (Windows, macOS, Linux) — With Ruby LSP extension
  • RubyMine (Windows, macOS, Linux) — JetBrains Ruby IDE
  • Ruby interpreterruby script.rb to execute
  • Any text editor — Ruby files are plain text

Technical specifications

Property Value
Typing Dynamic, strong
Paradigm Object-oriented (everything is an object)
Interpreter CRuby (MRI), JRuby, TruffleRuby
Package Manager RubyGems (gem), Bundler
Current Version Ruby 3.3+

Common use cases

  • Web development: Ruby on Rails applications.
  • Scripting: Automation and task scripting.
  • DevOps: Chef, Puppet, Vagrant configuration.
  • Prototyping: Rapid application development.

.RB compared to alternatives

.RB compared to alternative formats
Formats Criteria Winner
.RB vs .PY
Syntax philosophy and ecosystem
Ruby emphasizes expressiveness and multiple ways to accomplish tasks. Python emphasizes readability and one obvious way. Both are dynamic interpreted languages with large ecosystems.
Draw
.RB vs .JS
Web development versatility
JavaScript runs in both browser and server (Node.js), while Ruby is server-side only. However, Ruby on Rails remains a highly productive full-stack framework.
JS wins
.RB vs .PHP
Web framework productivity
Ruby on Rails pioneered convention-over-configuration and RESTful design patterns that PHP frameworks later adopted. Rails remains more opinionated and productive for rapid development.
RB wins

Technical reference

MIME Type
text/x-ruby
Developer
Yukihiro Matsumoto
Year Introduced
1995
Open Standard
Yes

Binary Structure

Plain text UTF-8 source code following Ruby syntax conventions. No binary headers or magic bytes. Files typically begin with optional shebang lines (#!/usr/bin/env ruby), magic comments for encoding declarations (# encoding: utf-8), require/require_relative statements, and then class/module/method definitions. Ruby files use end keywords to close blocks rather than braces.

1995Yukihiro Matsumoto releases Ruby 0.95, combining elements of Perl, Smalltalk, Eiffel, and Lisp2004Ruby on Rails 1.0 released by David Heinemeier Hansson, triggering massive Ruby adoption worldwide2007Ruby 1.9 introduces YARV bytecode VM, dramatically improving performance over the MRI interpreter2012Ruby standardized as ISO/IEC 30170:2012; JRuby reaches production maturity on the JVM2020Ruby 3.0 released with Ractor for parallelism, targeting 3x performance over Ruby 2.02024Ruby 3.3 ships with YJIT enabled by default, achieving the 3x3 performance goal
Run a Ruby script other
ruby script.rb

Executes the Ruby source file using the default Ruby interpreter (CRuby/MRI).

Start an interactive Ruby session other
irb

Launches the Interactive Ruby Shell for evaluating Ruby expressions in real time.

Install a gem dependency other
gem install rails

Downloads and installs a Ruby package from the RubyGems.org registry.

Check Ruby syntax without executing other
ruby -c script.rb

Parses the file and reports syntax errors without running the code. Outputs 'Syntax OK' on success.

RB EXECUTABLE render lossless Ruby scripts can be packaged into standalone executables using tools like Traveling Ruby or ruby-packer, bundling the interpreter and dependencies into a single binary.
RB BYTECODE (.YARB) render lossless RubyVM::InstructionSequence can compile Ruby source to YARV bytecode for faster loading, skipping the parse step on subsequent runs.
LOW

Attack Vectors

  • Arbitrary code execution if .rb files are sourced from untrusted origins and executed
  • Dependency confusion attacks via malicious gems on RubyGems.org
  • eval() and send() methods can execute arbitrary strings as code if user input is unsanitized

Mitigation: FileDex does not execute code files. Reference page only.

Ruby on Rails library
Full-stack MVC web framework that pioneered convention-over-configuration patterns
RubyMine tool
JetBrains IDE for Ruby and Rails with refactoring, debugging, and test integration
Bundler tool
Dependency manager that ensures consistent gem versions across environments via Gemfile.lock
RuboCop tool
Static code analyzer and formatter enforcing the Ruby community style guide
RubyGems service
Official package registry hosting over 175,000 Ruby libraries (gems)