Welcome to the most comprehensive Ruby course available on Udemy! An in-depth overview of coding with Ruby, a popular programming language renowned for its simplicity and elegance. Whether you’ve never written a line of code before or are looking to learn a brand new language, this course covers all bases!
Learn to Code with Ruby offers more than 40+ hours of video tutorials, 250+ lectures, and dozens of quizzes and coding exercises to test your knowledge as you proceed through the course.
Lessons include:
-
Installation and configuration for both Mac OS and Windows systems
-
Common programming concepts (variables, arithmetic, output)
-
Objects and methods
-
Strings
-
Numbers
-
Booleans
-
Methods and Conditionals
-
Ranges
-
Arrays
-
Hashes
-
Blocks, Procs, and Lambdas
-
Dates and times
-
File Input and Output
-
Regular Expression
-
Classes, Modules, and Inheritance
and more!
Ruby is a language released by Yukihiro Matsumoto in 1995 that bills itself as “a programmer’s best friend“. Every aspect of Ruby is designed to make programming easier for the developer. There is no better first language if you’re interested in learning how to program.
Ruby also serves as the foundation for Ruby on Rails, a popular web framework that powers over 1.2 million websites worldwide. The course offers an extensive introduction to the base language you’ll need to know if you intend to tackle web development in the future.
Check out the sample videos below to get a taste of what the course has to offer!
So if you’re ready to commit yourself, if you’re eager to expand your knowledge of programming, if you’re ready to discover what makes this elegant language so loved by developers, you are ready to Learn to Code with Ruby!
Thanks for checking out the course!
Introduction and Installation
Welcome to Learn to Code with Ruby! In this lesson, we introduce the language, its history, and some of its advantages/disadvantages relative to other languages.
Learn about object-oriented programming (OOP), a paradigm that views a software program as a collection of objects that interact with one another. Practice applying OOP principles to real-world objects.
In this lesson, we discuss how to install the latest version of Ruby.
In this lesson, we access the Terminal application on a Mac, which is used to issue text commands to the operating system. We explore popular commands like pwd, ls, and cd to traverse directories and explore their contents.
In this lesson, we'll install the XCode Command Line Tools, a technical prerequisite for installing Ruby on a macOS computer.
In this listen, we install Homebrew, a software package manager for macOS. We run Homebrew from our Terminal and use it to download/install applications.
In this lesson, we install the rbenv Ruby version manager, which enables us to download and install multiple versions of Ruby on the same machine.
In this lesson, we use rbenv to install Ruby on our macOS operating systems. We target the latest version of Ruby at the time of installation.
In this lesson, we download Visual Studio Code, the free text editor in which we'll be writing our Ruby code throughout the course. We also discuss the benefits of using such a tool.
In this lesson, we introduce the PowerShell command-line application and some common commands including ls for listing files/folders and cd for directory navigation.
In this lesson, we use our system settings to determine if our Windows version is 32-bit or 64-bit.
In this lesson, we walk through the process of installing Ruby on a Windows machine. We also use Powershell to confirm the language was installed properly.
In this lesson, we download Atom, the text editor in which we'll be writing our code throughout the course. We also discuss the benefits of using such a tool.
In this lesson, we'll add VSCode and its corresponding Terminal command, code, to our system PATH, which enables the Terminal to locate the software from any directory on our computer.
Download the course materials for the course in a single zip file.
In this lesson, we write our first Ruby program, which outputs the text Hello World to the screen.
In this lesson, we learn how to run our Ruby file using the ruby program from our Terminal.
In this lesson, we dive into Interactive Ruby (IRB), a REPL (Read Evaluate Print Loop) program for playing around with the Ruby programming language.
In this optional lesson, we'll review the concepts introduced in this course section including:
Installing Ruby
Running a Ruby file from then Command Line
Running a Ruby file with Code Runner
Getting Started
In this lesson, we'll learn more about the puts method, which outputs text to the Terminal/output when the program runs. The puts method adds a line break to the end of the output. Like other methods in Ruby, it can be invoked with and without parentheses. We can also use commas to output multiple elements with the put method; Ruby will separate each one with a line break.
In this lesson, we'll introduce escape characters, which are special symbols we can use in a Ruby string. Escape characters add special effects like line breaks, tabs, and symbols/characters to a string. We escape the expected pattern of output, which is Ruby outputting the literal characters that we've typed.
In this lesson, we introduce the print method, another way to output text to the screen. The print method is similar to puts but it does not add a line break to the end of the output.
In this lesson, we learn about the p method, which outputs a "technical" version of the object/output. For example, the p method will print a string with double quotes around the content. It exists primarily for the benefit of developers.
In this lesson, we'll learn how to use comments to ask Ruby to ignore specific lines of code. We create a comment with a hashtag/octothorpe (#) symbol. We can place the hashtag at the beginning of a line or after a line of valid Ruby code. Comments enable developers to leave explanations, metadata, annotations, diagrams, jokes, and more in their program.
In this lesson, you'll how to create multiline comments using =begin and =end. Ruby will treat any content between the two keywords as part of the comment.
In this lesson, we'll discuss the differences between integers and floating-point numbers and their syntax in Ruby.
In this lesson, we'll learn the symbols for mathematical operations including addition, subtraction, multiplication, division, and modulo.
In this lesson, we'll learn how to concatenate (join) two strings together using the + operator.
In this lesson, we'll learn about errors/exceptions in Ruby including TypeError, which Ruby raises when we provide an invalid type of object for an operation.
Review the concepts introduced so far in this section of the course.
Review everything we learned in this section of the course including output methods, comments, exceptions, concatenation, and more.
Variables
In this lesson, we'll learn about variables. A variable is a name we assign to a value in our program that is subject to change over time.
In this lesson, we practice declaring various variables in a .rb file and using them in expressions throughout the program. The variable syntax declaration begins a name, then an equal sign, and the value/object to assign that name to.
See the solution to the previous coding challenge.
In this lesson, we'll learn about the NameError exception, which Ruby raises when it cannot recognize a name in your program.
In this lesson, we'll learn how to declare multiple variables and provide initial values to them on a single line.
In this lesson, we'll learn how to swap two variables (invert the values they store).
In this lesson, we'll learn several shortcuts to perform an operation on a variable's value and assign the result back to the original variable.
In this lesson, we'll learn to declare constants in Ruby. A constant is a name for a value that will not change over the program's execution.
Review everything we've learned in this course section including variables, constants, parallel variable assignment, and more!
Object Methods
Welcome to the next section of the course! In this lesson, we begin our exploration of methods on various Ruby objects. A method is a message we can send to an object. A method produces a return value, which represents the final output of the method.
In this lesson, we learn about some methods on Ruby's Integer object including next, succ, and pred.
See the solution to the previous coding challenge.
- Continue discussion of return values from objects
- Introduce the nil object which represents nothingness, blankness, or the absence of a value
- Utilize string interpolation to inject variables or calculations into a string
- Practice the interpolation syntax -- a hashtag followed by curly braces (#{})
- Use the gets method to collect input from the user
- Use the chomp method to chop off the newline from the end of a string
- Write a program to collect input from the user and print it out to them
Review the concepts introduced in thsi course section including object methods, the nil object, the gets method, the class method, and more.
Booleans and Predicate Methods
In this lesson, we'll learn about a new object type called a Boolean, which represents either true or false
In this lesson, we'll explore the equality operator ( == ), which tests whether two objects are equal.
In this lesson, we use the inequality operator ( != ) to test whether two objects are NOT equal.
In this lesson, we'll learn various mathematical symbols available in Ruby including <, <=, >, and >= for greater-than/less-than logic.
In this lesson, we'll introduce predicate methods, which are methods that return a Boolean. These methods always end with a question mark.
In this lesson, we'll learn how to pass an argument to a method. An argument is an input we pass to a method that customizes how the method will run.
In this lesson, we'll practice passing multiple arguments to a method with the between? method. The between? method validates whether a number falls between a range.
In this lesson, we'll dive behind the scenes to see how Ruby translates numeric symbols like + into equivalent method calls on objects.
In this lesson, we'll learn about exclusive methods on Float objects including floor and ceil.
Review the concepts we've learned in this section including Booleans, predicate methods, equality and inequality operators, new object methods, and more.
Methods
In this lesson, we'll introduce the syntax for declaring a method in Ruby. A method is a reusable procedure that encapsulates a piece of logic; the intent is to capture the logic once and then reuse the method throughout the program.
In this lesson, we'll cover how to define a method with a parameter and utilize the parameter in the method body. We then invoke the method and pass in sample arguments.
In this lesson, we'll define a method with multiple parameters and pass in multiple arguments for its invocation.
Our method's arguments are regular Ruby objects so we are able to perform operations on them (such as invoking methods). In this lesson, we practice working with string and integer arguments to a custom method.
A local variable is a variable declared in a method body. Local variables only exist as long as the method executes. In this lesson, we practice declaring local variables and discuss the idea of scope, the boundary/confines within which a name exists in your program.
In this lesson, we'll learn how to declare a return value within our method. A return value is the final output of a method, the final product it creates for the outside world. Every Ruby method has a return value.
See the solution to the previous lesson's coding challenge.
Provide a default argument to a parameter, a fallback value to use when the invocation does not provide one.
See the solution to the previous lesson's coding challenge.
In this lesson, we'll review the concepts introduced in this section of the course including:
Methods
Parameters and arguments
Return values
Local variables and scope
Optional parameters and default arguments
Blocks
Welcome to the next section of the course! In this section, we'll focus on blocks in Ruby. A block is a chunk of code that is associated with a method invocation. In this lesson, we introduce the concept in combination with the times method, which repeats a chunk of code a specified number of times.
See the solution to the previous lesson's coding challenge.
In this lesson, we'll learn how to use vertical pipes to accept block variables in our blocks. A block variable is a dynamic value that exists only as long as the block does. It is a way for a method to pass data to the block.
See the solution to the previous lesson's coding challenge.
In this lesson, we'll learn two more methods, upto and downto, which move from a starter integer to an end integer in steps of 1.
In this lesson, we'll learn about the step, which iterates from one numeric value to another in steps/intervals. The method will enable us to practice more with blocks in Ruby.
In this lesson, we'll review the concepts introduced in this section of the course including:
Adding a block to a method
Single-line and multi-line block declaration
Differences between blocks and arguments
The times, upto, downto, and step methods
Conditionals
Welcome to the Conditions section of the course. In this lesson, we'll learn about the if statement, which enables us to run a section of Ruby code if a condition is met. Conditionals enable our programs to have branching logic.
In this lesson, we'll learn how to combine predicate methods with if statements. The two are a perfect duo because an if statement expects a Boolean and a predicate method returns a Boolean.
In this lesson, we'll introduces the concepts of truthiness and falsiness. A truthy value is one that is good enough to be true in a Boolean context; a falsy value is one that is good enough to be false in a Boolean context. false and nil are the two falsy values in Ruby; all other objects/values are truthy.