Advanced Ruby Programming: 10 Steps to Mastery

Take your Ruby programming to the next level with Huw Collingbourne's simple guide to advanced Ruby coding.
4.4 (155 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
20,422 students enrolled
80% off
Take This Course
  • Lectures 38
  • Length 12 hours
  • Skill Level Expert Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 11/2011 English

Course Description

Advanced Ruby: a 2nd-level course. If you have already done some Ruby programming, this course will help to take your coding to the next level. It explains some of the more advanced features of Ruby including blocks and procs, threads, regular expressions, exception handling, singletons and metaprogramming. The course is based on Huw Collingbourne's book, The Book Of Ruby (a copy of 3rd PDF edition of the book is supplied with this course). All the source code is provided in the code archive. This course can be used with any editor or IDE and on any operating system that supports Ruby. If you are ready to go beyond the basics and gain a deeper understanding of how Ruby really works, this course is for you.

Note: If you're new to programming, check out Ruby Programming for Beginners (now with over 24,000 students enrolled!).

What am I going to get from this course?

  • Encapsulation and data hiding
  • Singleton classes and methods
  • Exception handling
  • Threads and fibers
  • Modules and mixins
  • File handling
  • YAML and Marshal
  • Regular Expressions
  • Metaprogramming

Who is the target audience?

  • This course is for anyone who already knows the fundamentals of Ruby and wants to take their Ruby coding skills to a higher level. Here you'll learn the tricks and techniques of the Ruby masters

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Getting ready to go further in Ruby

What is this course about and who is it for? Watch this video to find out.


This is an intermediate-to-advanced level course on Ruby programming. It can be used with any code editor or IDE and any operating system that supports Ruby. This video provides a quick overview of the course and gives a few tips on how to get the most from it.

Here I explain the principal resources supplied by this course and how you should use them.
46 pages

This is the 'course text' – a short eBook that summarizes the most important topics from each of the steps of this course. Use this book to revise the subjects. It also contains links to useful resources such as Ruby installers, editors and IDEs.

237.2 kB

This contains an archive of all the code to accompany The Book Of Ruby and this course

422 pages
The Book Of Ruby is an extensive and in-depth eBook on Ruby programming. It provides a more in-depth text than the Course Notes (which are also downloadable from this section of the course). In over 420 pages The Book Of Ruby covers the Ruby language in great depth, starting with the very basics before moving onto quite complex subjects such as Exceptions regular expressions, threads and metaprogramming. Use this book to deepen your understanding of the topics covered in the video tutorials. All the sample programs mentioned in this book are provided for your use in the downloadable code archive.

Table of Contents


Chapter 1: Strings, Numbers, Classes, and Objects
Chapter 2: Class Hierarchies, Attributes, and Class Variables
Chapter 3: Strings and Ranges
Chapter 4: Arrays and Hashes
Chapter 5: Loops and Iterators
Chapter 6: Conditional Statements
Chapter 7: Methods
Chapter 8: Passing Arguments and Returning Values
Chapter 9: Exception Handling
Chapter 10: Blocks, Procs, and Lambdas
Chapter 11: Symbols
Chapter 12: Modules and Mixins
Chapter 13: Files and IO
Chapter 14: YAML
Chapter 15: Marshal
Chapter 16: Regular Expressions
Chapter 17: Threads
Chapter 18: Debugging and Testing
Chapter 19: Ruby on Rails
Chapter 20: Dynamic Programming

Appendix A: Documenting Ruby with RDoc
Appendix B: Installing MySQL for Ruby on Rails
Appendix C: Further Reading
Appendix D: Web sites
Appendix E: Ruby Development Software

Subscribers to this course are entitled to a 30% discount off the price of my other Ruby programming book, The Book Of Ruby , published by No Starch Press. In around 400 pages, The Book Of Ruby goes into more advanced Ruby topics such as blocks and nameless functions, threads and fibers, self-modify…

An overview of how to test conditions in Ruby and a first look at the alternative Boolean operators: and/&&, or/||, !/not


An explanation of why the same tests may produce different results if you change the style of Boolean operators. Also a look at the various types of if, else and unless tests, plus case statements.

3 questions

Performing tests in Ruby may seem easy. But there are some complexities which, unless you are very careful, can change the way your program works. Use this quiz to test your understanding...

Section 2: Classes, class methods and singletons

What are class methods and what are they used for? 


How to use class methods and class variables and why it’s important to understand that classes are objects too!


How to add methods to a specific object rather than to an entire class

3 questions

The difference between class and instance methods and variables, plus singletons.

Section 3: Arguments, return values and encapsulation

Regular arguments and default arguments, a discussion of parentheses, single and multiple return values and parallel assignment


Usually, there is one way to pass data to a method in a Ruby object and one way to get data back out again. But there are exceptions to the rule. Here I discuss the importance of encapsulation and information hiding.

3 questions

Information-hiding, returning values from methods and unintentional side-effects

Section 4: Exception Handling

Trapping exceptions and recovering from errors in your code. The fundamentals of exception handling techniques in Ruby.


Exceptions are objects and they have a class hierarchy which can be useful to you when handling specific types of error

3 questions

How to deal with errors

Section 5: Blocks, Procs and Lambdas

In Ruby blocks are like ‘nameless methods’ that are often used in iterators. This short video explains the basics


Blocks, procs, lambdas, block parameters, closures, passing blocks as arguments, yielding anonymous blocks and using blocks as iterators

3 questions

How to pass and execute blocks to methods. Careful! This is quite tricky!

Section 6: Symbols, Threads and Fibers

Symbols are widely used in Ruby programming. Here we find out what’s special about them

570.6 kB

This is Chapter 11 of The Book Of Ruby. It explains symbols.


Threads and Fibers can help you to write programs that do more than one thing at a time. But they can be tricky things to use effectively!

3 questions

What are Ruby Symbols? And how can threads help your programs multitask?

Section 7: Modules and Mixins

Ruby does not implement ‘multiple inheritance’. So how can a class include features from multiple parent classes? The answer is: it can’t. But it can mix-in multiple modules…


You just have to look at a module definition to see how similar it is to a class. But the resemblance is not superficial. Here I explain the relationship between a Class and a Module.


Modules as namespaces and as mixins. How to access module constants, module methods and instance methods and how to avoid potential problems 

3 questions

Modules, mixins and methods

Section 8: Files, YAML and Marshal

How to use Ruby's File and IO classes to read, write and copy files. How to find file information and traverse directories and subdirectories recursively.


How to save and load structured data to and from disk in a human readable format.


You can use Marshal to read and write byte streams of data to and from disk

3 questions

Opening and closing files, reading and writing data

Section 9: Regular Expressions

This explains the fundamentals of matching text patterns to find or modify strings using Regular Expressions


Some sample programs show how you can match patterns substitute text or create new files – for example, containing extracted documentation – using Regular Expressions

3 questions

Matching and replacing text patterns

Section 10: Dynamic Ruby and metaprogramming

How to add and remove methods at runtime, deal with method-calls to methods that don’t exist and evaluate strings as Ruby code.


In Ruby you don’t have to write a complete program before you run it. You can add new Ruby code to the program that is running. Here’s a simple example.

3 questions

Blurring the boundaries between code and data

Section 11: Ruby The Smalltalk Way

While the eBook is the core element of this section of the course, this video gives you a brief introduction to the notion of examining Ruby's Object Orientation in a historical context.

43 pages

This book explains some of the history of object orientation and compares the OOP features of Ruby with the influential Smalltalk language.


Download the source code archive to try out Smalltalk code (for either Dolphin or Pharo) and compare this with its Ruby equivalents.


If you want to try out Smalltalk and run some of the Smalltalk sample code, this video will show you how to get started with either Dolphin Smalltalk for Windows or Pharo on Windows, OS X or Linux.

Section 12: Extras
1.3 MB

This is a beginner's guide to Ruby. It also forms the basis for my other Udemy Ruby course for beginners. Refer to The Little Book Of Ruby if you need help with the fundamental features of Ruby programming (which are not covered in the current course).

27.3 kB

This is an archive of all the programs to accompany The Little Book Of Ruby

And finally...

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Huw Collingbourne, Director of Technology, SapphireSteel Software

Huw Collingbourne is the technology director at SapphireSteel Software, developers of the “Sapphire” Ruby IDE for Visual Studio and the “Amethyst” IDE for the Adobe Flash Platform. He is author of The Book Of Ruby from No Starch Press. He runs Bitwise Courses and teaches courses on a range of programming topics.

Huw has been a programmer for more than 30 years. He is a well-known technology writer in the UK. For over ten years he wrote the Delphi and Java programming column for PC Plus Magazine. He has also written numerous opinion and programming columns (including tutorials on C#, Smalltalk, ActionScript and Ruby) for a number of computer magazines, such as Computer Shopper, Flash & Flex Developer’s Magazine, PC Pro, and PC Plus. He is the author of the free ebook The Little Book of Ruby and is the editor of the online computing magazine Bitwise.

In the 1980s he was a pop music journalist and interviewed most of the New Romantic stars, such as Duran Duran, Spandau Ballet, Adam Ant, Boy George, and Depeche Mode. He is now writing a series of New Romantic murder mysteries.

At various times Huw has been a magazine publisher, editor, and TV broadcaster. He has an MA in English from the University of Cambridge and holds a 2nd dan black belt in aikido, a martial art which he teaches in North Devon, UK. The aikido comes in useful when trying (usually unsuccessfully) to keep his Pyrenean Mountain Dogs under some semblance of control.

Ready to start learning?
Take This Course