rb
What is a .rb file?
text/x-ruby
Ruby (.rb) is a plain-text source file for the Ruby programming language — a dynamically typed, object-oriented scripting language known for expressive, readable syntax and blocks. Everything is an object, and it is widely used for web development (Rails), scripting, and automation.
How to use a .rb file
Use an example .rb file to test syntax highlighters, the Ruby interpreter, linters and formatters (RuboCop), and parser or language-detection tooling.
Download example .rb files
- Ruby — Hello WorldThe classic hello-world in Ruby — a single puts — for testing highlighters, the Ruby interpreter, and parsers.
- Ruby — Stack (Enumerable, blocks, custom error)A realistic Ruby snippet: a Stack class that mixes in Enumerable, yields blocks, raises a custom error class, and uses string interpolation and symbol-to-proc — for testing highlighters, RuboCop, and parsers.