Ruby lessons
Happy developer language
Ruby was designed in 1995 by Yukihiro Matsumoto with a single guiding principle: programmer happiness. Every design decision in the language was made to keep the coder comfortable. The result is a syntax that reads almost like English — when you read a line of Ruby aloud, you can usually understand what it does.
What introduced Ruby to the world was Ruby on Rails. Released in 2005, this web framework radically accelerated web application development with the idea of "convention over configuration." Companies like GitHub, Shopify, Airbnb, and Basecamp grew with Rails.
In Ruby, everything is an object — even numbers. By writing 5.times do, you set up a loop that runs five times; because 5 is an object and times is its method. This consistency practically eliminates the question "is the rule different here" while learning the language.
- •→
Introduction to Ruby
First step into Ruby, the happy developer language: printing with puts, variables, and string interpolation.
- •→
Variables
Creating variables, naming, and constants (UPPERCASE).
- •→
Data Types
String, Integer, Float, Boolean; type checking with .class and conversion with to_i/to_s.
- •→
Operators
Math (+ - * / % **), comparison (== < >), and logic (&& || !).
- •→
Strings
Length, uppercase/lowercase, replacement (gsub), splitting (split), and joining (join).
- •→
Arrays
Array creation, appending (<<), mapping/selecting/summing, and iterating with each.
- •→
Hash (Dictionary)
Key-value storage, access, and iterating with each.
- •→
Conditions (if / else)
if-elsif-else, unless, ternary operator, and case/when.
- •→
Loops
Repeating with times, range (1..n).each, arr.each, and while.
- •→
Methods (def)
Defining functions with def, parameters, automatic return, and default values.
- •→
Classes
class, initialize constructor, @instance variables, and methods.
What you will learn
- Learning how to output with puts and define variables
- Storing data with arrays and hashes
- Understanding block structure and the use of each, map, and select
- Writing methods and using symbols
- The concepts of classes, objects, and modules
- String operations and matching with regular expressions
Who is this for?
- Those who want to develop web applications with Ruby on Rails
- Those looking for a highly expressive language that values readability
- Developers who will write automation and system scripts
When to use?
Ruby is efficient for rapid web application development, prototyping, automation scripts, and DevOps tools; transforming an idea into a working product with Rails takes a very short time.
It is not suitable for heavy computation, real-time systems, and mobile applications. Go or Elixir scale better for services requiring very high concurrency.
Frequently asked questions
Are Ruby and Ruby on Rails the same thing?
No. Ruby is a programming language; Rails is a web development framework written in Ruby. You need to know Ruby first to learn Rails — without understanding blocks, hash structures, and classes, Rails code looks like magic.
Is Ruby slow?
It lags behind Go or Java in pure computation speed. However, in most web applications, the majority of time is spent waiting on the database, not the language itself. With Ruby 3, performance has improved noticeably, and for most workloads, the bottleneck is not the language.
What is a block?
It is a piece of code passed as a parameter to a method. The code executed for each element when iterating over an array with each is a block. It is Ruby's most characteristic feature; loops, file opening, and resource management are always expressed with blocks.
What is the difference between a symbol and a string?
A symbol, starting with a colon, is created once in memory and reused; every time you write the same text as a string, a new object is born. Therefore, symbols are used for hash keys and fixed labels, while strings are used for content shown to the user or modified.
Summary
Ruby is one of the powerful languages for rapid web development with its readability-centered design and Rails ecosystem. In this tutorial, we progress from starting with puts to blocks, classes, and text processing.