Ruby Programming

Ruby Programming

English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 32 Lessons (3h 46m) | 555 MB

Intro and Setup
Welcome! After previewing the two Ruby programs we’ll write in this course, we help you get your development environment set up so you can start writing Ruby code.

Running Ruby
No time to waste—let’s run some Ruby code! We look at two ways: interactively using IRB and by writing Ruby program files. You’ll use both throughout this course and in your day-to-day Ruby programming.

ABCs and 123s
We gotta start somewhere, and every Ruby program has its fair share of strings and numbers. We get our program started with style by printing some text to the screen, using variables, and formatting strings.

Objects Everywhere
Pretty much everything in Ruby is an object. So we need to know how to create them, manipulate them, and get them to do things. You’ll learn object-oriented programming the Ruby way!

Self Curiosity
Lurking in the shadows, Ruby has a special object named self. It’s a bit mysterious at first, but we demystify self so you can use it with confidence.

Making Methods
The easiest way to make code reusable is to put it in a Ruby method. We learn how to define methods and call them with both positional and keyword arguments.

Crafting Classes
Ruby comes with a core set of built-in classes. But to write good object-oriented programs, we need to define our own classes representing the key concepts in our program.

Attr Is For Attribute
You often want to be able to read and/or write the internal state of an object, externally. That’s where Ruby attributes come in. When should you use them and how do they work? We answer that.

Symbols That Don’t Clang
Symbols, aiiieeeee! They seem so simple, and yet it’s tempting to overthink them at first. After seeing a few examples, you’ll totally get symbols.

What’s Your Condition?
If this, then that, otherwise something else. Depending on whether or not certain conditions are met, programs take different paths. We explore several ways to express conditionals in Ruby.

Array Party
Ain’t no party like an array party. You often need to put objects in a collection—a list of names, favorite movies, or game players—and then interact with them as a group. Ruby arrays are themselves objects with methods, and they’re used everywhere!

Objects Collaborating
At this point, we know how to create objects and work with them in isolation. But object-oriented programming is all about different kinds of objects working together. So we define our second Ruby class and design it to collaborate with our first class.

Self Revisited
The object referenced by the variable named self automatically changes depending on where we are in a program. How does that work and why is it important? We show you.

Organizing Files
Ruby has common-sense conventions for organizing code into files and directories. This makes it easier to find, reuse, test, and distribute our code.

Testing Assertively
Up to this point, we’ve written a fair amount of Ruby code. How do we know it works? Currently we have to visually inspect the output. That’s tedious and error-prone, so it’s time to write automated tests that verify our code always works as expected.

Blocky Blocks
Everywhere you look in Ruby, you’ll see blocks. Get really good with blocks, and you’ve got the gist of Ruby. We start with the basics of blocks and then explore more uses of blocks in future sections.

Struct and Data Values
Sometimes you just need an object that represents values. In those situations, reach for Ruby’s Struct or Data class. We show you when and how to use both.

Hashy Hashes
Second to arrays, hashes are the other Ruby collection type you’ll use most often. A hash is a collection of key-value pairs. Given a key, you can look up its value. And similar to arrays, hashes have a variety of convenient methods.

Enumerable Methods
Once you learn how to use the methods in Ruby’s built-in Enumerable
Taking User Input
No program is an island. It needs to interface with the outside world. And Ruby has elegant ways to read input and write output. We start by creating an interactive command-line interface to our program.

File Ins and Outs
Moving on to file I/O, we learn how to read data from a file and write the program’s results to another file. Along the way, we explore the File class which has a bunch of useful methods for working with files and directories.

Classy Methods
While refactoring our code, we discover an opportunity to define a class-level method and compare it to instance methods.

Uh-Oh, Exception!
Errors happen. Files go missing. Data is invalid. Network connections fail. And sometimes we just plain mess up. In this section we learn how to handle errors (exceptions) gracefully.

Rich Inheritance
One way to share code between classes is to use inheritance. We extend our program to include several new, specialized types to see examples of inheritance in action.

Mixin’ It In
Another, arguably better, way to share code between classes in Ruby is to use mixins. This is where

Neat Namespaces
Good Ruby citizens don’t pollute the global namespace. So to avoid naming clashes, we use

Make a Gem!
For the grand finale, we package up all the code and distribute it as a RubyGem. You learn how to write a GemSpec, build a RubyGem, and publish it to a public server.

Table of Contents

1 Introduction Intro to Course
2 Introduction Intro to Game
3 Running Ruby
4 ABCs and 123s
5 Objects Everywhere
6 Self Curiosity
7 Making Methods
8 Crafting Classes
9 Attr Is For Attribute
10 Symbols That Don’t Clang
11 What’s Your Condition
12 Array Party
13 Objects Collaborating
14 Self Revisited
15 Organizing Files
16 Testing Assertively Part 1
17 Testing Assertively Part 2
18 Blocky Blocks
19 Struct and Data Values
20 Module Mojo
21 Hashy Hashes
22 Enumerable Methods Part 1
23 Enumerable Methods Part 2
24 Taking User Input
25 File Ins and Outs
26 File Ins and Outs
27 Uh-Oh, Exception!
28 Rich Inheritance
29 Mixin’ It In
30 Neat Namespaces
31 Make a Gem!
32 Wrap Up

Homepage