Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Ruby
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Transcription

  • Related Services

Bookmark and Share
Lecture Comments (2)

1 answer

Last reply by: Professor Mui
Sun Nov 29, 2015 4:22 AM

Post by sam benites on November 28, 2015

Any one here?

Intro to Ruby

Intro to Ruby

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • What is Ruby? 0:06
    • What is Ruby?
    • Ruby Standard Library
  • Who Created Ruby? 1:22
    • Yukihiro Matsumoto
  • History 2:45
    • The Name 'Ruby'
    • Ruby v0.95
    • Ruby v1.0
    • English Language Mailing List Rubytalk
    • & the Mailing Lists
    • Ruby In The West
    • Ruby on Rails
    • The Pragmatic Programmer's Guide to Ruby
  • Current Ruby 14:42
    • Ruby 1.8.7, Ruby 1.9.3, and Ruby 2.0
  • Why Programmers Enjoy Ruby? 15:40
    • Why Programmers Enjoy Ruby?
  • Ruby Is An Interpreted Language 16:21
    • Ruby Is An Interpreted Language
  • What Is It Used For? 16:50
    • What Is It Used For?
  • Ruby is Object-Oriented 18:17
    • Example: 5.class
    • Example: 0.0.class
    • Example: true.class
    • Example: nil.class
  • Object Class 19:19
    • BasicObject
    • Example
    • Superclass
    • Fixnum → Integer → Numeric → Object

Transcription: Intro to Ruby

Welcome to Today's lesson is Intro to Ruby.0000

So, this is the first lesson, and this will be a very general overview. What is Ruby?0010

It's a dynamic programming language.0017

It's very expressive, and it's complex, but it's very simplified for all the things it can do.0025

As we go through many of the other lessons, you'll see why it's called complex.0032

But all these different functionalites built in it make it really easy--many different types of apps and features that you're making your application in.0040

Ruby does come with a core class library, and it has a very rich, powerful API.0052

It's also called the Ruby standard library.0061

So who created Ruby? It was a guy named Yukihiro Matsumoto.0083

He's better known as "Matz."0090

Before he used Ruby, he actually developed multiple other languages, but he was never satisfied with any of them.0094

When he created it, his philosophy for Ruby was that he wanted to design a language to make programmers happy.0106

That's a nice thing to have, I believe.0114

What he wanted to do was...he actually said that he wanted a scripting language that was more powerful than Perl, more object-oriented than Python--and that's why he decided to design his own language.0120

So, he's used in the past: Perl, C, Java... but he's never satisfied.0134

He has influences using Smalltalk list and Python. So he has a lot of influences, multiple influences for many languages.0146

So it's nice to know that the guy that's influencing it...made this really good language.0155

Let's talk about the history of Ruby.0163

The name itself, Ruby, was established on February 24th, 1993, in a chat session, actually. 0170

He had a chat with one of his cohorts, and they're discussing, "Maybe we should make a language!" and "What should it do?"0182

So, after they established a name and got the ball rolling, they actually released version 0.9.5 on December 1st, 1995.0190

At that time, in development, it was a very basic language.0203

They were still in progress, doing object-pointed design, adding classes with inheritance, mixins, iterators...0210

and remember, all these things that I'm saying, we will go over in further courses.0222

...closures, exception handling, and garbage collection.0227

About a year later, on December 25th, 1996, he actually released Ruby 1.0.0233

It was popular in Japan, but in the U.S., there had not been much influence of Ruby.0246

"What was it?" But it just so happened that, in 1999, a mailing list was created.0255

It was an English mailing list called ruby-talk that was established.0263

Right now, you can actually see that mailing list: it's mirrored at

This domain actually mirrors the ruby-talk mailing it's nice.0277

What I'd like to do is...let's open a browser and take a look at that website.0287

Let's go to ruby-forum and check it out.0299

First--you will notice I'm already in the Ruby Forum, but--I wanted to show you the actual main site.0302

As you go to, you will notice that it actually has quite a list of topics there.0311

The main one you will be using is just the first one, with "Ruby."0320

But you will notice that there are a ton of other forums here.0326

You will see, right below it..."Ruby on Rails" is a very popular framework.0330

It is used for web development, and that is the second forum.0335

The third one is Rails internationalization mailing list.0341

You will notice, if you go down this list, that a lot of them are all based on Rails.0349

So you have Rails deployment, Rails Engines, Rails Spinoffs...0353

...Rails France...and there are a lot of different forums, mailing lists--this is just a hodgepodge on this site.0362

Another popular one is one called Radiant CMS. That is kind of like a Wordpress for Ruby.0371

It's all built in Ruby, and it's a pretty clean CMS--very simple.0376

And you notice, if you go down here, another important one: Ruby-core. 0384

You can see what the core team is doing and what they're discussing,0388

and what they're going to do with the Ruby language.0395

Plus, if you go down even further, you will see there are actually different frameworks of Ruby.0400

There is JRuby--some integration thing to integrate it with Java.0407

IronRuby--you can use Ruby to implement a .net application.0411

And then they also have some back-end processes, like Mongrel and NGINX, to do back-end handling for web services.0418

They are not just used for Ruby, but those are used for other languages, too.0431

And there are other things there. You could sign up.0435

There is a "user" and a "register" link..."log in"..."sign up"..."show forum post"...0443

But let's just go ahead and click "Ruby" here.0451

You will notice that it lists the posts from newest to oldest.0453

You can see a lot of different topics here that are very...from the most recent to the oldest, but...0463

...if you have any questions in Ruby, a lot of them are already answered.0477

If you look at this list, you might have a question that you want to post, but maybe the best thing is to do a search to see what is over there.0481

Let's say I'm going to look up something with Ruby strings.0490

I can just do the "search subject" here, and you will notice it will give me all the posts from the latest one to the oldest one.0493

And I'm like, "Oh, what is this ruby_parser 3.0.1?" so I want to check it out.0503

So I can click on it and dive into it: it will tell me who posted it and give some examples of the code and some changes, bugs, examples from that.0508

I recommend you check that out, and you can log in and register to sign up for the Ruby Forum.0520

Next, I will also--I know this mirrors that mailing list for ruby-talk--0527

But also, you can go to,0537

and they have a mailing list URL. You can sign up, too.0542

So let's say you just want to get it straight to your email box.0547

You can actually subscribe here. You notice they have ruby-talk;0551

they have Ruby-Core--that mailing list deals with the core and implementation talks about Ruby.0557

Usually there are patches there. Ruby-Doc, can subscribe.0565

You can choose Ruby-Talk here, enter your name, your email address, subscribe, and click "Submit Form."0572

And it will add you to the mailing list.0578

So that is the Ruby-Talk mailing list forum. Let's continue on.0584

Like I just said, Ruby was built in Japan.0593

It got very popular there. It started getting popular in the West around 2000.0602

The first English book that was published was one called Programming Ruby.0607

With that, they translated a lot of things that were in Japanese, and made it so we can see that syntax in English and get a sense of how we can utilize it in our own programming...and see the flexibility and the expressions and the richness of it.0613

And then, what really got it going was in 2005.0635

The interest skyrocketed with Ruby on Rails.0639

This Ruby on Rails is a web framework.0643

It makes it very easy to get a website up and going.0649

They give you a lot of cool tricks and key things, like MVC-- that is a model-view-controller to separate and organize your code.0657

It's really made to be an all-in-one package for everything to build a website.0669

The creator of that is David Heinemeier Hansson, better known as DHH.0679

After that, Ruby really took off.0686

So, let's go ahead and take a look at some of these materials.0690

Definitely this Programming Ruby book, you probably want to use that as a reference even when you are doing your own Ruby development.0696

Let's go back here in the browser; what I'm bringing up is that URL...0701

This is the Programming Ruby book on the Internet.0709

And if you go here, the first two things, just like a normal book--0712

they have a frame here on the left, and he will give you a foreword of why he created this book and some references he used to create it.0722

And there you go--Yukihiro Matsumoto.0731

He wants Ruby to serve you, to make your programming easy, enjoyable, and have fun!0734

Don't you love that? It's great. So let's go ahead and move deeper in here.0741

You notice they have a preface; you can go ahead and read about this.0747

They give you a lot of introduction--more about Ruby and why it was created0755

and why you should learn it. 0763

"What kind of language is Ruby?" You can go ahead and read it...there are a lot of things. "Is Ruby for you?"0766

Read it, check it out...and why they wrote this book.0773

The instructions for installation are pretty old, so we do have a lesson to set up your Ruby environment0777

that I'll go over, that should be a lot more up-to-date.0788

I don't even know if that FTP link works.0792

Go ahead and try it out. They still use CBS.0797 starts with building Ruby, running Ruby, IRB... and we'll go through those in our own lesson.0804

So you won't be missing out. 0810

The other thing is...talking about Ruby on Rails very

This is an open source web framework, all built in Ruby. 0821

The Rails framework makes your websites very easy.0827

If you go here, you can see a lot of information about it.0831

It tells you about some sites that are using it; it tells you some information of who created it, and who is developing it right now.0835

They also have this link that says "Screencasts and Presentations."0849

If you click on that, you can see videos to get started on the Rails framework,0852

which is very nice. There is a lot of information there.0857

Basically, if you have a good foundation in Ruby, it will make learning these frameworks a ton easier.0863

That is what I hope we can do in this course for you.0876

Currently, Ruby is 1.9.3. 0883

That is considered stable right now.0892

1.8.7 is the latest one in the 1.8 world.0897

You might see that on your laptops, if you are in Mac OS and you have one of the latest operating systems-- it might default to the

We're going to be using 1.9.3 for these lessons, and you will use a lot of the new objects and things in it to get your environment running.0914

Ruby 2.0 is in development, and there iss a plan to release in 2013.0928

It will be quite exciting, seeing what they get done there.0934

So why do programmers enjoy using Ruby?0940

It's portable. It's lightweight.0946

It's easy to learn, and a lot of people say it's a real pleasure to program.0952

There aren't any weird symbols in it. It's very friendly; it reads like a book.0958

And it's flexible. You'll see it used for many different types of programming methodologies.0963

...and used for many different types of applications, not just websites or web apps.0969

Ruby lets you decide how you want to do things.0975

Ruby is an interpreted language, but it is also a scripting language.0980

You will see a lot of key concepts in procedural programming built in.0990

Functional programming...a lot of key concepts there, too. So there are many different styles you could use it for.0997

But, really, Ruby is more of a general-purpose programming language with a system that you can use for many different things.1002

So, where can you see it being used? What is it being used for?1009

You will see it in graphical user interface applications.1017

If you are ever looking at a website, it might be being used for some middle-tier server process.1021

That is something behind the scenes, after the front end...some process getting sent to do some transaction for an ecommerce site...or doing some search. 1028

It is also used for managing server machines and databases.1040

...Rails--serving webpages using Ruby on Rails...1047

You are definitely using it to serve your webpages.1054

And generating dynamic content, again...doing metaprogramming and serving up different content on the Web.1061

You can do that with Ruby. Writing AI and machine language programming--Ruby is able to do that, too.1071

You will also see frameworks to go to games using Ruby.1079

Plus you have mobile development: you have frameworks that allow you to create iOS apps, and you can also make mobile websites using, mobile development, as well.1083

Ruby is object-oriented.1097

Every value is an object.1104

If you look right here, you will notice that even if I have a number, that number itself is an object.1109

Where else in code can you see a number called .class?1123

When I do that, it's going to tell me what object it is. So it says this object, 5, is a Fixnum object.1127

If I call doesn't end it; that is still an object. I can call it .class, and it will tell me that it's a Float.1134

And even Boolean statements have true or false: there is a class for that.1144

So we call up true.class. You get TrueClass.1149

And even nil is an object itself--so, nil.class--you will get NilClass.1152

So, you see, everything in Ruby is an object.1158

Every object has an underlying object that is a parent, except this class called the Basic Object.1166

The parent of all objects is this one that's called "Basic Object."1176

But the child of that is "Object."1184

And, when you see all of these other ones--Fixnum, Integer, Numeric--they all inherit from Object.1191

So you often see this Fixnum, Integer, Numeric...that is its parent.1198

Or, I should say, its ancestor--you'll see it ahead of it.1206

So going back, this Object class we were talking about...1209

it's a method that is accessible to all the different classes.1219

And it's the parent of all classes, except that Basic Object. Basic Object is the top.1222

If you ask the code, "What's the parent of this object?" it's going to be null, because there is nothing above that.1228

So, we go back and look at these classes.1234

If I just call up 5.class, I get Fixnum.1240

But I can ask Ruby, "Who is the parent of this class?"1244

And the parent of the class is called the superclass.1249

When I say, "Where is the superclass," what I really want to say is, "Who is the parent?"1253

And so I do Fixnum.superclass, and it will give me Integer.1265

Integer.superclass--it will say it's a Numeric, and Numeric.superclass is Object.1277

Notice how we started with the Fixnum from the number 5, and we kept going up the ranks, all the way to Object.1282

At the end, we found out that Object is the parent, and all these different classes inherit from it--1292

Numeric, Integer, and Fixnum.1306

Basically, that is what I want you to know.1314

Everything is an object, and all of them lead to Object at the end result.1320

Well, that is the end of this lesson. I hope you enjoyed it and look at our next lessons so we can get deeper into the Ruby code and setting up your system to use it.1327