Introduction To Ruby Programming Language On Linux

Course

December 31st, 2017

Intro Video

Photo of David Smith

David Smith

Vice President of Technology

David loves computers, especially alternative operating systems, coding, and crazy desktop managers. David has been an avid Linux user since 1999, when he installed Slackware for the first time. Since then, he has taught himself the ins and outs of Linux and web programming.

Length

05:34:53

Difficulty

Intermediate

Course Details

This course will teach the basics of the Ruby programming language. We will cover basics of installing Ruby via the package manager of CentOS and Ubuntu, as well as installing Ruby with RVM, the Ruby Version Manager. We will learn the basic syntax of Ruby, and cover how to code our own methods, classes, modules and much more. Through the Intermediate and Advanced sections of the course we will build an Apache log parsing program. We will build upon it throughout the later lessons, until we end up with a nice working log parsing program.

Syllabus

Getting ready to code.

Introduction

An Introduction to the course materials and the ruby language in general.

Course Overview

00:03:13

Lesson Description:

This is a brief overview of what this course will cover.

What's a Programming Language?

00:06:59

Lesson Description:

A Brief introduction about programming languages

Installing Ruby

00:08:48

Lesson Description:

Covering the most popular ways to install the ruby environment on both CentOS and Ubuntu, using package managers and RVM.

The Ruby Environment

00:04:59

Lesson Description:

Covering the basics of what goes into the ruby envrionment

Exercise: Ruby Environment Setup

00:30:00

Learning Basic Ruby Syntax

Ruby Basics

Hello World!

00:03:10

Lesson Description:

Take a look at the basic "Hello World" program. Learn a little about methods and method arguments.

Variables

00:05:32

Lesson Description:

Learn what variables are, and how to define them.

Types of Variables

00:09:22

Lesson Description:

Learn about different types of variables.

Basic Math

00:03:49

Lesson Description:

Basic Math in Ruby

Conditionals

00:06:24

Lesson Description:

Learn the basic structure of conditionals in Ruby.

Conditionals Continued

00:07:33

Lesson Description:

Learn about compound boolean expressions and conditionals

Iterators

00:05:49

Lesson Description:

Learn how to use a basic iterator.

Arrays and Hashes

00:06:28

Lesson Description:

Learn some basic ways of manipulating arrays and hashes. Learn about nested collections.

Strings

00:04:19

Lesson Description:

Learn some basic ways to manipulate strings.

While Loop

00:06:40

Lesson Description:

Learn the basic structure of the while loop.

For Loop

00:02:55

Lesson Description:

Learn about the for loop.

Loop Control

00:04:39

Lesson Description:

Learn how to skip around or exit from a loop.

Methods

00:08:12

Lesson Description:

Learn how to write your own methods in Ruby.

Methods Continued

00:05:20

Lesson Description:

Learn about writing methods with arguments.

Using Classes

00:05:53

Lesson Description:

Learn the basics of classes, and some of the theory behind object oriented programming.

Creating Classes

00:07:10

Lesson Description:

Create your first class, and learn how to instantiate it.

Creating Classes Continued

00:07:52

Lesson Description:

How to set class inheritance, initializers, and private and protected methods.

Variable Scope Revisited

00:03:46

Lesson Description:

Variable scope use in class definitions.

Class Methods and Singletons

00:07:56

Lesson Description:

Learn how to define class methods in Ruby, as well as singleton methods and singleton classes.

Exercise: Getting Acquainted with Ruby (Hello World - Conditionals)

00:30:00

Exercise: Practice with Nested Hashes and Iterators

00:30:00

Exercise: Writing Methods

00:30:00

Exercise: Writing a Program that Utilizes a Class

00:30:00

Start Building a Log Parsing Program

Intermediate Ruby

Log Parsing Program

00:08:55

Lesson Description:

Get started writing an application in ruby. Learn the basics of MVC style programming. Note:We have included files in your home directory, if you are using the provided "Ruby On Linux Ruby 101" server from the dropdown list in your server lab.

Strings and Escapes

00:08:49

Lesson Description:

Let's do some fancy stuff with ASCII and ANSI escape codes: clear a terminal, move the cursor around, change colors... You might find the following links useful: ASCII Control Codes http://en.wikipedia.org/wiki/ASCII#ASCII_control_code_chart ANSI CSI Codes http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes ANSI Color Codes http://en.wikipedia.org/wiki/ANSI_escape_code#Colors

User Input

00:08:33

Lesson Description:

Let's get into the nitty gritty of standard input, and figure out how to interact with our program.

Exception Handling

00:05:30

Lesson Description:

Sometimes the unexpected happens. When it does, ruby raises an exception. This allows the programmer to make contingency plans and keep the program running.

Filling in the MVC stubs

00:16:16

Lesson Description:

In this lesson we will primarily fill in the code for our MVC. We will focus on code for displaying directory contents, and use the Dir class.

File Objects

00:08:16

Lesson Description:

Learn how to manipulate files, open them up, read them, check and set permissions, and write data to them.

Reading a Log File

00:09:11

Lesson Description:

We'll integrate our knowledge of the File class into our log parsing program. After this course our program will display the contents of a log file.

Regular Expressions

00:11:25

Lesson Description:

In order to quickly separate out the data in our log file, we will use a regular expression. But first, we'll learn the basics of regular expressions and how to use them in ruby.

Building the LogEntry Class

00:08:32

Lesson Description:

In this lesson we will utilize the method we created in the Regular Expressions lesson, and fill out our LogEntry class with data and methods.

Time

00:06:19

Lesson Description:

Learn about the Time class.

Symbols, Strings, Comments

00:04:44

Lesson Description:

A general discussion about the differences between strings, symbols. And some details about how to use comments and naming conventions to your advantage.

Modules and Mixins

00:04:31

Lesson Description:

Learn how to write a module, and use it.

Advanced Math

00:02:02

Lesson Description:

A quick look at the Math module.

Sorting Part 1

00:14:16

Lesson Description:

In this lesson we will start building the UI for sorting and filtering in our  log parsing program.

Sorting Part 2

00:15:35

Lesson Description:

In this lesson we will set up the back end to apply the sorting and filtering categories to our log_entries array.

Exceptions Revisited

00:06:36

Lesson Description:

In this lesson we will apply some exception handling practices to our program, to ensure that it functions properly.

LogEntry Display

00:03:56

Lesson Description:

In this lesson we will add a view and controller actions to be able to display a one page printout of a line of the log file.

Method Arguments Addendum

00:04:23

Lesson Description:

Sometimes you need more than variables when you define methods. Learn about array decomposition, variable numbers of arguments, and keyword arguments.

Dive into concurrent processing models.

Advanced Ruby

Threads

00:13:42

Lesson Description:

Learn about threads in ruby, how to created them and use them in your program.

Thread Queue

00:03:59

Lesson Description:

Learn how to keep data in sync with a thread queue.

Progress Bar

00:09:41

Lesson Description:

We have the tools to build a progress bar on our log parsing program now. Let's put it together.

Mutex

00:04:38

Lesson Description:

Sometimes you need to block other threads from processing. You can use a mutex to do that.

Fibers

00:07:39

Lesson Description:

Fibers are like threads, but light-weight.

Sub Processes, etc

00:10:14

Lesson Description:

We'll give an overview of various ways to create sub-processes, lauch external programs, and work with them.