How to Use The Initialize Method in Ruby

The initialize method is part of the object-creation process in Ruby & it allows you to set the initial values for an object. In other programming languages they call this a “constructor”. For example: Let’s say that you have a Point class, this point needs two coordinates, x & y. How are you going to … Read more

How to Control a Web Browser From Ruby With Watir

Did you know that you can control your web browser with Ruby? The Watir gem allows you to do this. And it comes with the full power of modern browsers: You can take a screenshot of the visible area of the page You can run javascript on any page, without having to manually open the … Read more

Ruby Inheritance Explained – Learn OOP Today!

Class inheritance is a fundamental OOP (Object-Oriented Programming) feature that helps you create a more specific & specialized version of any class. Here’s an example: Food -> Fruit -> Orange There’s a relationship between these classes! We can say that an orange is a fruit, but fruits are also food. The parent class (also called … Read more

How To Use Environment Variables in Ruby

An environment variable is a key/value pair, it looks like this: We use these variables to share configuration options between all the programs in your computer. That’s why it’s important to learn how they work & how to access them from your Ruby programs using the ENV special variable. Examples of environment variables: You can … Read more