Code Enlightenment Is Through Ruby


Welcome to Truly Ruby! This tutorial is designed to help you unlock your programming potential through the incredibly powerful Ruby programming language. If you dare embark on this harrowing journey, you will discover that Ruby is the answer to many problems in the life of a developer. So join us, learn the dark (and fun) secrets behind this remarkable language and elevate your coding self to the level of Truly Ruby!

You may ask yourself "What exactly does that mean?"

To become a Ruby Master you must become one with Ruby. "What exactly does that mean?" You may ask yourself. Perhaps it will become clearer if you answer this question: Have you ever wished that a language could just read your mind? You know, accept a train of thought as input? Maybe technology hasn't granted us 'Matrix'-style computers but satisfying this desire is where Ruby truly shines. By being intuitive and flexible Ruby allows you to put your thoughts into your programs. If we want to put something into our program we can use the puts command. puts (short for 'put string') is a way we get Ruby to display something on the screen. puts is very much like the related command print, except puts adds a newline after the result and print does not.

Now with that in mind, consider the following line of code:

4.times {puts 'I am but an object in a sea of Ruby code.'}


If we were to write out a sentence explaining what action this code snippet performs, it would read very much like the code itself. "Display 'I am but an object in a sea of Ruby code.' on the screen 4 times." Simple and intuitive. Just like coding should be.

Remember when I said Ruby can read your mind? This is an excellent example of how the intuitive syntax makes it feel as though Ruby really could. As ideas for your code pop up, Ruby is there to represent the thought behind the code. Often times you can read Ruby code aloud and get a good idea of what that piece of code is supposed to do.

Let's look at another snippet of code:

best_actress = 'Jennifer Lawrence' unless 'Brie Larson'.include? 'son'


As before it is easy to understand what this code does. We could say (albeit a little awkwardly) "best_actress is 'Jennifer Lawrence' unless 'Brie Larson' includes 'son'. So unless Brie Larson gets a name change before the Academy Awards, Jennifer Lawrence probably won't need to clear more space off of her mantle for another gold statue.

We can translate our thoughts into Ruby code easily because Ruby was designed to be easy on the programmer. The life of a programmer can be hard. Working long hours staring at a computer screen endlessly typing page after page. Knowing myriad languages, all with their own quirky syntax (some more intuitive than others). That's why Japanese developer Yukihiro 'Matz' Matsumoto developed Ruby in 1995. He focused first on developer needs and convenience rather than machine requirements. Matz once said,

"Programmers often feel joy when they can concentrate on the creative side of programming. So Ruby is designed to make programmers happy."
By making coding easier and more fun, Ruby allows developers to relax and do more cool things with their code. And who doesn't love cool things?

Enough tomfoolery, now begins your journey toward Code Enlightenment. First you will become Newly Ruby as you learn about objects, data types, methods, and control flow. Then to ascend to Duly Ruby you must discover the wonders of arrays and hashes and how to navigate them by writing your own methods. Finally, to reach your goal you must journey back to your origins and unlock the hidden power of classes and objects. Then and only then can you become Truly Ruby...