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.
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 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.
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.
This contains an archive of all the code to accompany The Book Of Ruby and this course
Table of Contents
Introduction
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
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.
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...
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
The difference between class and instance methods and variables, plus singletons.
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.
Information-hiding, returning values from methods and unintentional side-effects
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
How to deal with errors
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
How to pass and execute blocks to methods. Careful! This is quite tricky!
Symbols are widely used in Ruby programming. Here we find out what’s special about them
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!
What are Ruby Symbols? And how can threads help your programs multitask?
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
Modules, mixins and methods
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
Opening and closing files, reading and writing data
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
Matching and replacing text patterns
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.
Blurring the boundaries between code and data
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.
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.
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).
This is an archive of all the programs to accompany The Little Book Of Ruby
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.