Ruby is a dynamic, object-oriented language designed to make programmers happy. It reads almost like prose, treats everything as an object and bends easily into small domain-specific languages. It is known for web development, scripting and tooling, and for a culture that values readable code, testing and convention over configuration.
Key concepts
- Everything is an object: numbers, strings and classes all respond to messages.
- Blocks and iterators: code passed to a method, the heart of loops, callbacks and resource handling.
- Open classes and modules: classes can be reopened, and modules add shared behaviour as mixins.
- Duck typing: what matters is what an object responds to, not its class.
- Metaprogramming: methods can be defined, intercepted and inspected at run time.
- Gems and bundler: libraries are packaged as gems, with dependencies pinned per project.
Vocabulary
- Symbol: a lightweight, immutable name such as :id, used for keys.
- Mixin: a module whose methods are added to a class.
- Proc and lambda: objects that wrap a block of code.
- Idiom: the habitual Ruby way to write something, such as each rather than a counting loop.
What to study, in order
- Basic syntax, strings, arrays and hashes, in the interactive shell.
- Methods, blocks, and the Enumerable methods such as map and select.
- Classes, modules, mixins and how method lookup works.
- Write a command-line tool with tests, and package it as a gem.
- Metaprogramming in small doses: define methods dynamically and read a library's source.
- A web application with a framework, once the language is comfortable.