Ruby
A general-purpose, dynamically typed, multi-paradigm programming language designed for programmer productivity and readability. The substrate of Ruby on Rails and the principal influence on a generation of dynamic-language web frameworks.
- Paradigms
- imperative · OOP · functional
- Typing
- dynamic
- Memory
- gc
- Version
- 3.4
- First released
- 1995
Ruby is a general-purpose, dynamically typed, multi-paradigm programming language whose design emphasises programmer productivity and the expressiveness of the language’s object model. Every value in Ruby — including integers, strings, classes, and the result of every expression — is an object with methods that may be invoked through the conventional . syntax. The language inherits the dynamic, message-based dispatch of Smalltalk, the programmer-focused ergonomics of Perl, and the structural conventions of Ada and Eiffel. Programs are translated to bytecode and executed by a virtual machine; the reference implementation is CRuby (also called MRI, Matz’s Ruby Interpreter), with alternative implementations including JRuby on the JVM and TruffleRuby on GraalVM.
History
Ruby was designed by Yukihiro Matsumoto — universally referred to as Matz — in Japan beginning in February 1993, with the first public release 0.95 in December 1995. Ruby 1.0 followed in December 1996. Adoption outside Japan grew substantially after the December 2000 publication of Programming Ruby by Dave Thomas and Andrew Hunt, the first comprehensive English-language reference. The release of Ruby on Rails by David Heinemeier Hansson in July 2004 established Ruby as a mainstream choice for web application development through the late 2000s and 2010s. Ruby 1.9 (2007–2009) introduced the YARV virtual machine and substantial syntactic refinements; Ruby 2.0 (2013) introduced refinements and keyword arguments; Ruby 3.0 (2020) introduced a tracing JIT (MJIT) and pattern matching, and committed to substantial performance improvements over the 2.x series. The current release is Ruby 3.4, with the YJIT just-in-time compiler enabled by default.
Hello world
puts "Hello, world!"
Execution with the reference interpreter:
ruby hello.rb
Project-level dependency management is performed by Bundler, which reads a Gemfile declaring the required gems and writes a Gemfile.lock recording the resolved versions:
# Gemfile
source "https://rubygems.org"
gem "rails", "~> 8.0"
Ruby installations are conventionally managed by a version manager — rbenv, rvm, chruby, or asdf — that permits multiple toolchain versions to coexist and selects between them through a project-level .ruby-version file. The official package registry is RubyGems.org.