Ruby Programming

Developer happiness, one elegant line at a time.

Introduction to Ruby

Meet the language built for developer happiness — from a 1995 hobby project to the Ruby 3 era.

Ruby Syntax and Data Types

puts, variables and the core values — Integer, Float, String, Symbol, true, false and nil — all in one tour.

Operators

Add, compare, repeat and split values with operators — and watch precedence pick the order for you.

Control Flow

Teach programs to decide: if, elsif, unless and case turn true/false questions into different paths.

Loops and Iterators

While loops, times, each and upto — make Ruby repeat the work without copy-pasting a single line.

Methods

Wrap code into reusable methods with def, pass in parameters and let the last expression fly back out.

Arrays

Store ordered lists of values, grab anything by index, push new items on and walk everything with each.

Hashes

Key–value pairs the Ruby way: symbol keys, instant lookups, and what happens when a key is missing.

Strings

Quotes, interpolation and a toolbox of methods — bend text into any shape with Ruby's friendliest type.

Symbols and Ranges

Symbols are Ruby's lightweight names; ranges are number spans — small types you will use every day.

Blocks, Procs and Lambdas

Attach chunks of code to method calls, store them in variables as Procs and lambdas, and hand them around like objects.

Exception Handling

Meet begin, rescue, raise and ensure — how Ruby lets a program stumble, clean up after itself and keep going instead of crashing.

Modules and Mixins

Bundle reusable methods into a module and mix them into any class with include — sharing behavior without inheritance.

Object-Oriented Programming Basics

Classes, objects, initialize and attr_accessor: build your own blueprints and stamp out objects that carry state of their own.

Inheritance and Class Design

Extend a class with class Dog < Animal, override its methods, and let super borrow the parent version exactly when you need it.

Metaprogramming Basics

Peek under the hood: call methods by name with send, write methods at runtime with define_method, and catch unknown calls with method_missing.

File Handling

Read, write and walk through files the Ruby way — open with a block and the handle closes itself, errors or not.

Regular Expressions

Patterns in slashes: find where text fits with =~, harvest every match with scan, and rewrite strings with sub and gsub.

Threads and Concurrency

Threads run code side by side — spawn them with Thread.new, wait with join, and see why their console output can interleave.

Gems and Standard Library

require, RubyGems and the standard library: JSON, Date and Set are one require away — never hand-roll what already exists.