What is Ruby?

Who’s seen the classic film entitled The Wizard of Oz? If you have, you may be familiar with Dorothy’s iconic ruby slippers. Did you by chance know that the creators of The Wizard of Oz initially wanted the slippers to be silver? They certainly made the right choice by upgrading to ruby. Similarly, a bright mind by the name of Matsumoto once upgraded his coding experience by developing the programming language, Ruby.

If you have yet to code with Ruby, you have found the perfect introductory blog post to give you some Ruby background before getting started!

What is Ruby?

Ruby is a programming language. To elaborate on that, Ruby is an object-oriented programming language.

What is Object-Oriented?

This means that all values within code are treated as objects with characteristics defining them. Each element represents an object and has properties just like physical objects do. Additionally, each object has methods that are particular to it.

To elaborate on Ruby’s identity even further, Ruby is known as a ‘general purpose’ language due to the diverse range of projects you can create using it. Come to think of it, Ruby is referred to as a lot of things, one being a ‘multi-paradigm’ programming language.

Simplicity is the name of the game when it comes to Ruby. It is simple to type and read. To that end, Ruby is a high-level programming language.

What is a High-Level Programming Language?

Wait, we’ve asked this question before! The following excerpt is from a previous Hostwinds blog post entitled ‘An Intro to Python.’

Definition of High-Level Programming Language: A high-level programming language is one that closely resembles a language spoken by people. High-level languages make it easier to code because they are more intuitive than low-level languages.”


READ MORE: An Intro to Python


Have You Heard of Ruby’s Principle of Least Astonishment (POLA)?

This principle goes along with the whole ‘simplicity’ concept we’ve been harping on. POLA essentially means making things as uncomplicated as possible. Ruby syntax is reminiscent of the English language. Such being the case, it isn’t astonishing that a certain command written in Ruby does what it does. This is why Ruby is so appealing to those who are new to coding.

On a similar note, Ruby has other principles that it has to live up to. For instance, Ruby is meant to be helpful for humans, not necessarily computers. In other words, Ruby was crafted to ensure that humans, the ones in charge here, not computer robots (which were made for the sole purpose of serving humans), have a user-friendly experience while working with Ruby. It doesn’t matter if Ruby is user-friendly for computers, because they are robots!

Ruby wears many hats. Yes, it’s both high-level and object-oriented language, but it’s also a scripting language and an interpreted language. Are we getting too far ahead of ourselves here? Let’s run through some quick definitions just to be safe.

What is a Scripting Language?

A scripting language executes commands automatically through a specific run-time system.

What is an Interpreted Language?

Our ‘Intro to Python’ blog post covered this one for us: An interpreted language “[…]is translated to a format that a computer can understand at runtime. Accordingly, no compiling takes place […]. Rather, the code is executed right away at runtime.”

Presently, Ruby is a very, very popular language that’s mainly used to build web applications. Let’s see how Ruby’s journey down the yellow brick road all began.

A Little Ruby History

Ruby was first introduced to the world in 1995 by Yukihiro Matsumoto. Matsumoto, or ‘Matz,’ released Ruby version 1.0 in 1996. As stated above, Ruby is employed a lot for web programming, particularly because the very reason it was invented was to increase productivity. How? Its uncomplicated and simplistic style and syntax, of course.

Here’s How Ruby Came to Fruition: This is somewhat of a Goldilocks and the Three Bears story. Matsumoto built Ruby after realizing he wasn’t satisfied with either Python or Perl. Python needed more object-oriented functionality as far as Matsumoto was concerned, while Perl needed more power. Matz decided he wanted to work with a completely new programming language that was a sort of hybrid between the best parts of Python and Perl.

Enter Ruby!

Ruby Syntax

Ruby’s clean, concise, and compact syntax allows one to create programs a lot quicker than the average programming language. Parentheses, for instance, aren’t a necessity. Ruby’s syntax doesn’t need much punctuation at all for that matter. In fact, you don’t even have to add a semicolon at the end of each segment of code. In that case, you could just insert a line break between that chunk of code and the next to achieve the same effect.

This programming language happens to be case-sensitive. Identifiers are not even excluded from Ruby’s case-sensitive rule. Identifiers are just the names given to various methods and variables.

Onto more syntax! Ruby uses blocks and defines them via braces and keywords. Furthermore, whitespace doesn’t matter in Ruby. Therefore, you can begin coding with Ruby on whatever line you would like.

On a different note, you don’t have to declare variables when you use Ruby. All of the instance variables in this unique language are completely private. Ruby uses accessor methods in order to reveal the variables.

A Ruby Accessor Method Looks Something Like This:

What are Variable Scopes?

Variable scopes refer to the areas in a program where certain variables are present. Ruby has local, class, instance, and global levels of variable scopes.

Getting a Little Bit More Intricate Here: Ruby supports first-class continuations. It would take a lot of time to unpack that one, but we highly suggest looking up the term. It’s quite fascinating.

There are many others where that came from.

Tip to Further Your Understanding of the Complex Things Ruby Can be Used For: Look up ‘Metaprogramming.’

One More Tip: Look up ‘Lexical Closures’ and ‘Parametric Polymorphism.’

Now we’re ready to set up a little bit of Ruby code. First off, you should know that every Ruby file ends in ‘.rb.’ Let’s say our Ruby file is called ‘myrubyfile.rb.’

If we simply want to display “Hostwinds loves you!” on a web page, for example, all you have to type is the following:

Now run this:

Guess what your page will display? You got it!


Hostwinds loves you!


If you would like to make comments in Ruby, simply add a ‘#’ in front of the sentence(s).

Now, if you need to make several lines of comments, you can also type ‘=begin’ before the comments and ‘=end’ after like so:

That is just a small glimpse of what Ruby looks like.

What is Ruby on Rails?

Ruby on Rails is Ruby’s open-source library, or framework. Such software library was developed by David Heinemeier Hansson. Ruby on Rails is a library that expands Ruby functionality.

Ruby on Rails is also called ‘Rails.’

One of the cool things about Ruby on Rails is that you don’t technically need to know Ruby like the back of your hand in order to understand the former. It certainly helps, particularly with syntax, however, it is not required. Ruby on Rails is responsible for the creation of fantastic applications such as Hulu and Shopify!

What is RubyGems?

RubyGems is a module manager for Ruby. You can pull from Ruby-supported software libraries (or applications) in order to expand Ruby’s functionality.

Fun Fact: Each software library contained within RubyGems is referred to as a ‘Gem.’ Tens of thousands Ruby Gems exist today.

Other than Ruby’s standard library, the programming language supports modules such as HTTP, XML, JSON, and many others.

Ruby Features

There are a number of features that make Ruby unique and helpful.

Namely, the following:

Duck Typing:

Once more, we’ll employ the help of our “An Intro to Python” blog piece to provide you with a few definitions here.

Definition of Duck Typing: In order to properly define duck typing, allow us to explain the ‘duck test.’ If the object quacks and walks like a duck, it indeed a duck. This terminology is used within the realm of object-oriented programming because the object is defined by its properties and methods rather than its type.”

Garbage Collection:

Definition of Garbage Collection: Garbage collection is the method of tracking every single object stored in memory, then ultimately disposing of objects that aren’t being used. While that definition doesn’t even remotely cover the intricacies involved in this process, it will do for the purposes of this blog piece. For more information about garbage collection in this context, we suggest looking up ‘First Generation Object.’”

Dynamic Typing:

Definition of Dynamic Typing: To type dynamically is to execute code at runtime, thereby skipping the extra step to compile the code.”

More Features Include:

  • Operation Overloading
  • Strictly-Enforced Encapsulation
  • Exception Handling
  • The Use of Iterators
  • The Use of Meta-Classes
  • Inheritance
  • Linux user? Windows user? Ruby can run on both as well as both Solaris and Mac

Developers can also combine Ruby with an Integrated Development Environment (IDE) in order to construct applications even faster.

Ruby’s fantastic community isn’t a feature, per say, but it is surely worth mentioning when listing the perks of working with this language. Ruby’s large community works together by volunteering information and support so they can continue to innovate and improve each year. This lively crew even assists new developers in a variety of ways. In addition, the community updates members about Ruby news such as recently-created libraries.

Before we conclude, are you curious to know what commonly-used applications have been made with Ruby?

Ruby Has Been Used To Make Prestigious Programs Including But Not Limited To :

  • Groupon
  • Github
  • Twitter
  • Simulations for High-Profile Corporations like Motorola
  • And way, way more!

Paint the Town Ruby

The best news about Ruby? It is an open-source programming language, meaning you can begin using it now at no cost!

So what are you waiting for? Let’s all paint the town Ruby and try using this powerful object-oriented programming language ASAP!

P.S. Comment below if you would like Hostwinds to write a subsequent blog post about Ruby on Rails! Farewell for now, folks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.