rubyguides

Tutorial series

Ruby Fundamentals

16 tutorials — follow in order for the best learning path.

  1. Installing Ruby on Your Computer

    A step-by-step guide to installing Ruby on macOS, Linux, and Windows. Learn multiple methods including Homebrew, rbenv, RVM, and RubyInstaller.

  2. Getting Started with Ruby

    Write your first Ruby program and learn the fundamentals of the Ruby programming language in this beginner-friendly tutorial.

  3. Ruby Basics: Variables, Types, and Operators

    Learn how to store and manipulate data in Ruby with variables, understand Ruby's data types, and master operators for expressions.

  4. Control Flow: if, unless, loops

    Learn how to control the flow of your Ruby programs with conditionals and loops. Master if, unless, case, while, until, and iterators.

  5. Defining and Calling Methods in Ruby

    Learn how to define, call, and use methods in Ruby to organize your code into reusable blocks.

  6. Working with strings in Ruby: a complete tutorial

    Create, format, and manipulate strings in Ruby. Covers literals, interpolation, methods, mutation, encoding, and the most common patterns you'll need.

  7. Working with arrays in Ruby: a beginner tutorial

    Work with arrays in Ruby: creation, indexing, slicing, mutation, iteration with each and map, set operations, and common Enumerable patterns.

  8. Hashes in Ruby

    Learn how to use hashes in Ruby to store and organize data with key-value pairs. This tutorial covers creating, accessing, modifying, and iterating over hashes.

  9. Blocks and Iterators in Ruby

    Learn how to use blocks, iterators, and yield in Ruby to write expressive, reusable code that powers everything from simple loops to complex data processing.

  10. Classes and Objects in Ruby

    Learn how to define classes, create objects, use initialize, instance variables, and accessor methods in Ruby.

  11. Modules and Mixins

    Learn how to use Ruby modules as namespaces and mixins to share behavior across classes. Includes practical examples of the include and extend keywords.

  12. Error Handling with begin/rescue

    Learn how to handle errors gracefully in Ruby using begin, rescue, ensure, and raise. Build robust programs that recover from unexpected situations.

  13. File I/O in Ruby

    Learn how to read from and write to files in Ruby. Covers File, IO, FileUtils, reading line-by-line, writing, and best practices for handling files safely.

  14. Methods in Ruby

    Learn how to define, call, and customize methods in Ruby — from basic syntax to keyword arguments, visibility, and idiomatic conventions.

  15. define_method in Ruby

    Learn how to dynamically define methods at runtime using Ruby's define_method, with practical examples and real-world patterns.

  16. Variables and Types in Ruby

    A practical tour of Ruby's five variable scopes, the core type hierarchy, runtime type checking, duck typing, and type conversions.