Ruby

A dynamic, elegant language designed for developer happiness and productivity.

Object-Oriented
Functional
Imperative
Beginner
1995
Yukihiro Matsumoto

Overview

Ruby is a dynamic, open-source language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. Everything in Ruby is an object. Ruby on Rails, the web framework that popularized Ruby, introduced conventions like MVC and "convention over configuration" that influenced web development across all languages.

Key Features

  • Everything is an object — Even numbers and nil are objects with methods
  • Blocks & procs — First-class closures enabling elegant DSLs
  • Metaprogramming — Runtime class modification and method_missing
  • Gems ecosystem — RubyGems.org hosts thousands of libraries
  • Convention over configuration — Rails philosophy minimizes boilerplate

Code Example

ruby
class Greeter
  def initialize(names)
    @names = names
  end

  def greet
    @names.map { |name| "Hello, #{name}!" }
          .each { |greeting| puts greeting }
  end
end

Greeter.new(["World", "Ruby", "Hacker"]).greet

Learning Resources

Learning Path

14 topics across 4 sections

1Basics

2Collections & Iteration

  • Arrays — Creation, slicing, map, select, reject, flatten
  • Hashes — Symbol keys, default values, merge, and transform
  • Blocks, Procs & Lambdas — yield, Proc.new, lambda, and the block/proc distinction
  • Enumerable — each, map, reduce, group_by, and lazy enumerators

3OOP

  • Classes & Modules — attr_accessor, initialize, inheritance, and mixins
  • Metaprogramming — method_missing, define_method, and open classes
  • Patterns — Duck typing, convention over configuration, and DSLs

4Ruby on Rails

  • MVC Architecture — Models, views, controllers, and the Rails request cycle
  • Active Record — ORM, migrations, validations, and associations
  • Testing — RSpec, Minitest, FactoryBot, and TDD practices